Dj Boilerplate
A Django boilerplate/template for building production level projects
Features
Frontend
Backend
Getting Started
Follow the steps to get your app running
-
git clone https://github.com/almahdi404/djboilerplate
-
Rename the
djboilerplate
folder name with your new project name -
cd
into the project folder -
On Linux/Mac :
-
Run :
bash setup.sh
-
Activate the virtual environment :
source env/bin/activate
-
-
On Windows :
-
Create a virtual environment named env :
python -m venv env
-
Activate the virtual environment :
env/Scripts/activate
-
Install the dev requirements :
pip install -r requirements/dev.txt
-
Duplicate the
.env.example
file and rename the new file to.env
-
Inside the
.env
file, setENV=dev
-
Generate a random SECRET_KEY :
python manage.py genskey
, copy it -
Inside the
.env
file, set it as theSECRET_KEY
value
-
-
Start the server :
python manage.py runserver
-
Go to localhost:8000 to see your project running
How it works
- Settings
- the settings module is divided into
base.py
,dev.py
,pro.py
files. bothdev.py
andpro.py
extends thebase.py
file - when using
python manage.py runserver
,dev.py
is used ifENV=dev
andpro.py
is used ifENV=pro
pro.py
is always used inwsgi
andasgi
application- secret variables are imported from
.env
file using thedecouple.config
function
- the settings module is divided into
- Apps
- Sass
- a compiler function in
apps/core/sass.py
is called when the server is started or reloaded - when
DEBUG=True
, it will watch for .scss file changes in static folders and compile it,threading
is used to accomplish this task - when
DEBUG=False
, then it will compile all .scss files inSTATIC_ROOT
once
- a compiler function in
Contribute
If you wish to contribute to this project, please first discuss the change you wish to make via an issue.