Skip to content

A project template for Django 1.10 that follows best practices.

License

Notifications You must be signed in to change notification settings

hamedtorky/django-starter-template

 
 

Repository files navigation

django-starter-template

An easy to use project template for Django 1.10 that follows best practices.

alt text

Features

Quickstart

First create and activate your virtualenv, you can use virtualenvwrapper. Then install Django 1.10 in your virtualenv:

pip install django==1.10

To create a new Django project (make sure to change project_name)

django-admin.py startproject --template=https://github.com/fasouto/django-starter-template/archive/master.zip --extension=py,md,html,txt,less project_name

cd to your project and install the dependences

pip install -r requirements.txt

If you need a database, edit the settings and create one with

python manage.py migrate

Once everything it's setup you can run the development server: http://localhost:8000/

python manage.py runserver

How to use it

Settings

Settings are divided by environments: production.py, development.py and testing.py. By default it uses development.py, if you want to change the environment set a environment variable:

export DJANGO_SETTINGS_MODULE="my_project.settings.production"

or you can use the settings param with runserver:

python manage.py runserver --settings=my_project.settings.production

If you need to add some settings that are specific for your machine, rename the file local_example.py to local_settings.py. This file it's in .gitignore so the changes won't be tracked.

Bootstrap

Bootstrap 3 LESS files are included and compiled with django_compressor. There's an file less/app.less where you should put your CSS to avoid overriding the bootstrap LESS files, so you can update bootstrap easily.

Make sure you have lessc installed on your production server, for development it uses less.js.

Dependencies

We are following Kenneth Reitz's pip workflow to handle requirements files. The requirements_to_freeze.txt contains unpinned requirements and requirements.txt contains the pinned versions to use in a deployment.

If you have trouble/can't install a package place it in the /libs directory.

TODO

  • Add webpack with live SASS reloading.
  • Once we have webpack upgrade to bootstrap 4
  • Add gitlab.ci
  • Improve tox.ini
  • Improve deployment, get rid of fabric. Investigate feasible options. Maybe add a deploy to heroku/docker cloud.
  • Add some example code and tests.

About

A project template for Django 1.10 that follows best practices.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 61.6%
  • JavaScript 29.3%
  • Python 4.4%
  • HTML 3.0%
  • Nginx 1.7%