An awesome way to kickstart your Django projects!
Report Bug
·
Request Feature
Managing your Django project and all its dependencies can be a nightmare. This also includes managing dependencies in virtual environments, securing your SECRET KEY
, adding files to .gitignore
, running code style validations and what not.
Why not simplify this tedious and repetetive work?
With this objective in mind, I created Django Template
, a simple and minimalistic django project template that fits all your requirements.
Simply click on Use this template button on top to get started. Go ahead and choose a cool name for your project. Clone the newly created repository and continue with the following steps.
This project is optimized to run on Linux Environments. Tests for Windows and Mac are still in progress.
After getting a local copy on your system, run the following commands based on your role.
-
If you are a developer who is just starting with a new project, simply run
make project
A prompt will ask you to enter a valid project name before continuing. This command will setup your virtual environment, secret keys and all the basic dependencies required by a django project.
Note: While developing, it is advisable to enter your virtual environment for proper configuration and better control. To enter a virtual environment, use
. bin/activate
To deactivate the environment, simply use
deactivate
commanddeactivate
Alternatively, if you prefer a finer control over your project creation,you can use the following commands
-
Install all project dependencies and create virtual environment
make install
-
Make django project using
django-admin
django-admin startproject --template=./etc/structure ${project-name} .
Replace
${project-name}
with the name of Django project as per your wish. Also, you can customize the template for your project,according to your need.
Note: This directory will now function as your root django folder. Upon creation of a project, a folder named
${project-name}
andmanage.py
will appear at the root.
-
-
If the repository already contains a django project, you can simply install the requirements and run the project.
To install all the dependencies, use
make install
You can use make
commands to perform various operations on your django project.
-
Start django server on port
8000
. You can customize it by editingPORT
inMakefile
.make run
-
Apply database migrations
make migrate
-
Clear database records.
make flush
Note: Media files will not be deleted using this command
-
Update project requirements (useful for deployment)
make freeze
This command will add all your project dependencies to
etc/requirements.txt
, making it very easy for deployment. -
Running Django Testcases
make test
-
Check for proper formatting and import style using
black
andisort
make format
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.