Coder Social home page Coder Social logo

suqi / django-project-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caktus/django-project-template

0.0 1.0 0.0 1.57 MB

Django project template for startproject (Requires 1.8+)

Makefile 1.16% SaltStack 2.05% JavaScript 3.50% Shell 85.37% Python 5.16% HTML 2.74% CSS 0.02%

django-project-template's Introduction

{% if False %} Installation ------------

To start a new project with this template:

django-admin.py startproject \
  --template=https://github.com/caktus/django-project-template/zipball/master \
  --extension=py,rst,yml \
  --name=Makefile,gulpfile.js,package.json
  <project_name>

{% endif %} {{ project_name|title }} ========================

Below you will find basic setup and deployment instructions for the {{ project_name }} project. To begin you should have the following applications installed on your local development system:

A note on NodeJS 4.2 for Ubuntu users: this LTS release may not be available through the Ubuntu repository, but you can configure a PPA from which it may be installed:

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

You may also follow the manual instructions if you wish to configure the PPA yourself:

https://github.com/nodesource/distributions#manual-installation

Django version

The Django version configured in this template is conservative. If you want to use a newer version, edit requirements/base.txt.

Getting Started

First clone the repository from Github and switch to the new directory:

$ git clone [email protected]:[ORGANIZATION]/{{ project_name }}.git
$ cd {{ project_name }}

To setup your local environment you can use the quickstart make target setup, which will install both Python and Javascript dependencies (via pip and npm) into a virtualenv named "{{ project_name }}", configure a local django settings file, and create a database via Postgres named "{{ project_name }}" with all migrations run:

$ make setup
$ workon {{ project_name }}

If you require a non-standard setup, you can walk through the manual setup steps below making adjustments as necessary to your needs.

To setup your local environment you should create a virtualenv and install the necessary requirements:

# Check that you have python3.5 installed
$ which python3.5
$ mkvirtualenv {{ project_name }} -p `which python3.5`
({{ project_name }})$ pip install -r requirements/dev.txt
({{ project_name }})$ npm install

Next, we'll set up our local environment variables. We use django-dotenv to help with this. It reads environment variables located in a file name .env in the top level directory of the project. The only variable we need to start is DJANGO_SETTINGS_MODULE:

({{ project_name }})$ cp {{ project_name }}/settings/local.example.py {{ project_name }}/settings/local.py
({{ project_name }})$ echo "DJANGO_SETTINGS_MODULE={{ project_name }}.settings.local" > .env

Create the Postgres database and run the initial migrate:

({{ project_name }})$ createdb -E UTF-8 {{ project_name }}
({{ project_name }})$ python manage.py migrate

If you want to use Travis to test your project, rename project.travis.yml to .travis.yml, overwriting the .travis.yml that currently exists. (That one is for testing the template itself.):

({{ project_name }})$ mv project.travis.yml .travis.yml

Development

You should be able to run the development server via the configured dev script:

({{ project_name }})$ npm run dev

Or, on a custom port and address:

({{ project_name }})$ npm run dev -- --address=0.0.0.0 --port=8020

Any changes made to Python, Javascript or Less files will be detected and rebuilt transparently as long as the development server is running.

Deployment

The deployment of requires Fabric but Fabric does not yet support Python 3. You must either create a new virtualenv for the deployment:

# Create a new virtualenv for the deployment
$ mkvirtualenv {{ project_name }}-deploy -p `which python2.7`
({{ project_name }}-deploy)$ pip install -r requirements/deploy.txt

or install the deploy requirements globally:

$ sudo pip install -r requirements/deploy.txt

You can deploy changes to a particular environment with the deploy command:

$ fab staging deploy

New requirements or migrations are detected by parsing the VCS changes and will be installed/run automatically.

django-project-template's People

Contributors

vkurup avatar mlavin avatar dpoirier avatar copelco avatar nmashton avatar kmtracey avatar daaray avatar vrocha avatar tobiasmcnulty avatar poirier avatar ironfroggy avatar calebsmith avatar robline avatar chenull avatar

Watchers

Matt Su avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.