Project use SQlite3 database for development and PostgreSQL database in production.
- Create the virtual environment
python3 -m venv ./venv
or make venv
- Activate the virtual environment
source venv/bin/activate
- Install all python dependencies
pip install -r requirements.txt
or make pip
- Install node modules
npm install
- Create environment variables:
cp example.env .env
or make env
- Apply DB migrate
python manage.py migrate
or make migrate
- Starting the project
npm start
├── Makefile # Global projects shortcuts
├── README.md # You are reading this file now
├── app
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── frontend # Contains all RAW frontend files.
│ │ ├── css
│ │ ├── fonts
│ │ ├── img
│ │ ├── js
│ │ └── templates # Contains all HTML templates
│ │ ├── index.html
│ │ ├── layout.html # The main template that contains all markup. All other pages are inheriting this template.
│ │ └── partials # Contains some small HTML templates
│ │ ├── footer.html
│ │ └── header.html
│ ├── migrations
│ ├── models # Contains all app models
│ ├── static # Contains BUILDED static files
│ ├── tests.py
│ ├── urls.py # App urls
│ └── views # Contains all app views
├── backend
│ ├── __init__.py
│ ├── config
│ │ ├── __init__.py
│ │ ├── apps.py # Apps connected to project
│ │ ├── base.py # Base project settings
│ │ └── db.py # DB settings
│ ├── settings.py # Project settings
│ ├── urls.py # Global project urls
│ └── wsgi.py
├── example.env # Example environment file
├── gulpfile.babel.js # Gulp config. Contains build scripts for fonts and images and some commands
├── manage.py
├── package.json # NPM requirements and shortcuts
├── requirements.txt # Python requirements
├── server.js # Webpack Hot Module Reload (HMR) server script
├── webpack.base.config.js # Webpack BASE config. Contains all basic webpack settings. All other configs are inheriting it.
├── webpack.local.config.js # Webpack DEVELOPMENT config. Contains webpack settings for development
└── webpack.prod.config.js # Webpack PRODUCTION config. Contains webpack settings for production
- Building frontend for production
npm run build
- Starting dev server only (without watching frontend)
npm run server
- Starting dev server with watching images and fonts and Webpack Hot Module Reload
npm start
- Get update project from repo (master branch)
make pull
- Make new virtual environment
make venv
- Install all python dependencies
make pip
- Collect DB migrations
make migrations
- DB migrate
make migrate
- Update environment state
make env
- Update project from repo, check new dependencies and DB migrations
make update
- Run develop server
make dev
- Collect static
make static
- Install NPM dependencies
make npm
- Deploy project on server (update, make venv, install all dependencies, collect static)
make deploy
Environment file contains attributes:
-
ENVIRONMENT
. DB setting. Can bedev
andmaster
.dev
use sqlite3 database.master
use PostgreSQL database. -
SECRET_KEY
. Project secret key. Use different keys for every new project! -
DEBUG
. Switch on/off develop mode. Useyes
in develop mode andno
in production. -
DB_NAME
. PostgreSQL database name. -
DB_PASS
. PostgreSQL database password. -
DB_USER
. PostgreSQL database user. -
DB_HOST
. PostgreSQL database host. -
DB_PORT
. PostgreSQL database port. -
SENTRY
. Switch on/off sentry. Usetrue
to switch on sentry in project. -
SENTRY_DSN
. Sentry DSN.
Example environment file:
ENVIRONMENT=dev
SECRET_KEY=some_strong_password
DEBUG=yes
DB_NAME=name
DB_PASS=pass
DB_USER=user
DB_HOST=localhost
DB_PORT=5432
SENTRY=false
SENTRY_DSN=dsn_of_your_cool_project
To install Flake 8 pre-commit hook:
- Install Flake 8 pre-commit hook;
flake8 --install-hook git
- Setup up hook;
git config --bool flake8.strict true