Skip to content

tutuca/django-project-template

This branch is 23 commits ahead of apanruning/django-project-template:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

fc4ceb9 · Sep 14, 2016

History

26 Commits
Mar 13, 2016
Sep 14, 2016
Jun 9, 2016
Mar 13, 2016
Sep 14, 2016
Feb 5, 2015
Mar 13, 2016
May 4, 2016
Mar 13, 2016
Mar 13, 2016
Mar 13, 2016
Sep 14, 2016
Mar 13, 2016
Mar 13, 2016
Sep 14, 2016

Repository files navigation

{{project_name}}

Note: This is just template text, please adjust to your needs

This is a project template to be used to kickstart a django based website.

This template includes:

  • A base layout and bootstrap scaffolding.
  • Dev tools such as ipdb or django-debug-toolbar.
  • A modern toolchain for javascript and sass.
  • Some random sugar.

Ussage

Clone this package:

$ git clone git://github.com/tutuca/django-project-template.git

Setup and activate a virtual environment:

$ cd ~/venvs/ # or wherever you want
$ virtualenv {{project_name}} -ppython3
$ source {{project_name}}/bin/activate

Setup your python dependencies:

({{project_name}})$ cd ~/Projects/{{project_name}} # wherever you cloned this
({{project_name}})$ pip install -r requirements.txt

Install the package in development mode:

({{project_name}})$ python setup.py develop

Create a blank application

$ django-admin.py startapp  <app_name>

Add it to INSTALLED_APPS in {{project_name}}/settings.py and define your environment settings in a blank {{project_name}}/local_settings.py.

#local_settings.py
DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2', 
    'NAME': '{{project_name}}',
    'USER': 'postgres',
    'PASSWORD': '',
    'HOST': '',
    'PORT': '',
    }
}   

Initialize your database as usual.

First create your schemas and run default migrations:

$ {{project_name}} migrate

Note that {{project_name}} is django's usual management wrapper made available session-wide by setup tools.

Whenever you made further changes to your models run:

$ {{project_name}} makemigrations <app_name>

Static assets toolchain.

We rely on npm and grunt to handle the static assets dependency management and build tasks. Under the hood it is using:

  • webpack: Javascript bundle
  • babel: JS Compiler, allowes us to use ecmascript 6 syntax.
  • sass: CSS compiler, allowes us to use variables and mixins.
  • bootstrap: In it's official sass port, it is the most widely used layout framework with a large variety of built-in components.

While using this tools should be transparent to you as dev. Knowing their roles, uses and pitfals will help you write better code (and to fix them if they brake :).

We also ship eslint and stylelint.

To install the required tools and libraries use:

$ npm install  

Then you may run:

$ grunt

By default this is run in watch mode and will listen for changes in the assets folder as well as package.json and Grunfile.js files.

This will populate the static/ folder which will be served by django's development server.

Now you are ready to run the development server:

$ {{project_name}} runserver

Licence notice:

© 2016 {{project_name}} - {{author}}, A copy of the project licence is available at COPYING.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 41.4%
  • JavaScript 27.3%
  • HTML 25.8%
  • Nginx 3.0%
  • CSS 2.5%