Skip to content

mysociety/django-project-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mySociety's Django project template

This is a template for creating Django projects (using Django's facility for such) in a mySociety-ish way. It's probably not all that useful to you unless you are a mySociety developer, or are interested in how we do things.

Usage

Set up from a fresh empty repository (i.e. after you've done git init and cd-ed into that new folder:

You need to install Django to use the template. We do that in a virtualenv (replace project_name with whatever you want the top level name of your Django project to be).

$ virtualenv ../virtualenv-project_name
$ source ../virtualenv-project_name/bin/activate
$ pip install Django

Now you can create the project (again, replace project_name with the real name):

$ django-admin.py startproject --template=https://github.com/mysociety/django-project-template/archive/master.zip --extension py,yml,bash,conf-example,yml-example,md --name Vagrantfile project_name .

The project template includes a Vagrantfile to start your development environment with the basics you need for a standard project (PostgreSQL, etc) and a few extras like mailcatcher that make life easier for development. To start that, type:

$ vagrant up

(Make a cup of tea, it will take a while)

App template

When adding an app, we have another template for that:

$ ./manage.py startapp --extension md --template=https://github.com/mysociety/django-app-template/archive/master.zip app_name

README Generation

The following Django template will be used to generate a basic README for your project - you're encouraged to make it better!

{{ project_name|capfirst }}

Installability

Put a top-level description of your project here.

Local development

This project includes a Vagrantfile to make local development easy. Simply run:

$ vagrant up

To get a fully configured vagrant development environment. The code is installed into /vagrant/{{ project_name }} inside the VM, and you can run the Django dev server with:

$ source virtualenv-{{ project_name }}/bin/activate
$ python manage.py runserver 0.0.0.0:8000

The website will then be running at http://localhost:8000

About

A mySociety-specific Django project template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published