Skip to content

artinnok/django-big

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Big

Intro

This cookiecutter main features

  • Settings splitted into base/local/production
  • Requirements splitted into base/local/production
  • Urls splitted into base/local/production
  • Fabfile for remote deployment
  • Celery for asynchronous tasks
  • Common behaviors (mixins) for models
  • Common models
  • webpack.js for static files handling - JS and SCSS build
  • dotenv for environment variables

Python Interpreter version

  • Python 3.4.3+

Main project dependencies

  • Django - Python MVC web framework
  • Celery - asynchronous queue
  • Fabric - deployment and system administration tool
  • cookiecutter - command line tool that creates projects from templates
  • python-dotenv - convenient environment variables management tool
  • webpack.js - module bundler
  • npm.js - package manager for javascript

OS requirements

  • Mac OS X
  • UNIX like OS

Work with cookiecutter

Clone project

git clone git@github.com:artinnok/django-default.git

Install cookiecutter

[sudo] pip install cookiecutter
or
[sudo] easy_install cookiecutter
or on Mac OS X
[sudo] brew install cookiecutter

Start interactive cookiecutter install process:

cookiecutter django-default

After fast installation proccess you receive yoursite_project with structure:

Repository level:

yoursite_project/
├── README.md
├── django-default
└── env

Project level:

yoursite/
├── config
├── core
├── manage.py
├── requirements
└── templates

App level:

core/
├── __init__.py
├── admin.py
├── apps.py
├── behaviors.py
├── common_models.py
├── migrations
├── models.py
└── views.py

Install virtualenv

[sudo] pip install virtualenv
or
[sudo] easy_install virtualenv
or on Debian and Ubuntu
[sudo] apt-get install virtualenv

Create virtual environment for yoursite_project

cd yoursite_project # repository level
virtualenv -p python3 env

Generate your project SECRET_KEY

You can generate key via django-extensions:

python manage.py generate_secret_key

Or at this site.

Add your SECRET_KEY

Open in your preferred text editor (vim, nano etc.) file env/bin/activate and prepend to end this part:

export SECRET_KEY='here your generated key'
export DJANGO_SETTINGS_MODULE='config.settings.local'

Activate virtual environment

source env/bin/activate

Install requirements

cd yoursite # project level
pip install -r requirements/local.txt

Migrate database

python manage.py migrate --settings config.settings.local

Install Node.js + npm

on Debian and Ubuntu
sudo apt-get install -y build-essential
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
or Mac OS X
[sudo] brew install node

Install npm dependencies

On project level

npm install

Build static with webpack

webpack

Run local server

On project level:

python manage.py runserver --settings config.settings.local

Enjoy!