Git Product home page Git Product logo

heroku-django-skeleton's Introduction

Dependency Status

Introduction

This project is a simple skeleton to get you started with Django and Heroku. It currently uses the stable release of Django 1.5. The steps below should get you up and running quickly.

Installation

To get started, first install the Heroku Toolbelt. This will provide access to the necessary command-line tools.

Prepare the virtualenv you'll be using with the following commands:

virtualenv venv --distribute
source venv/bin/activate
pip install -r requirements.txt

Then copy env.sample to .env. Foreman uses this file to set environment variables when running commands. Create a new PostgreSQL database and set the access information.

Issue the following commands to create the database and apply any migrations.aeracode.org/)).

foreman run python manage.py migrate

You're now all set for local development, to start the development server, simply run

foreman run python manage.py runserver

You can then access the local development server at http://localhost:8000/.

Deployment

Deploy

The project is already set up for easy deployment with Heroku by clicking the button above. Note that you will be warned if your account will be charged for the addons installed. While I make no guarantees, I have attempted to select only free addons which leave room to upgrade. You are still responsible for verifying any fees associated with any addons which will be installed.

For the first deploy, and each new deploy, simply run git push heroku master. Initially, and when the schema changes, run migrate.

heroku run python manage.py migrate

You can view your new deployment in your browser via heroku open. Static file serving can be modified to use Amazon S3. Create a bucket on S3 and add the configuration to your Heroku installation.

heroku config:add AWS_ACCESS_KEY_ID="<AWS access key>"
heroku config:add AWS_SECRET_ACCESS_KEY="<AWS secret>"
heroku config:add AWS_STORAGE_BUCKET_NAME="<bucket name>"

If using S3, you will find collectstatic takes a long time to run on every deploy. To disable running automatically, simply set DISABLE_COLLECTSTATIC=1. You can then manually run collectstatic via

heroku run python manage.py collectstatic --noinput

Dependency management

To add a new dependency to your project, simply install via pip install after activating the virtualenv. To track newly installed packages, run pip freeze -l > requirements.txt to update the requirements file. Note that you should manually remove setuptools or distribute if they appear in this file as this can cause slug compilation to fail.

Background tasks

This project is ready to go with background jobs via Celery. Just define a task as specified in the documentation.

By default, no workers will be running. To start one, run the following command. Note that you WILL be billed by Heroku for running this additional dyno.

heroku ps:scale celery=1

heroku-django-skeleton's People

Contributors

michaelmior avatar bitdeli-chef avatar liltimtim avatar

Stargazers

Juyeon avatar Luis Angel Reyes Bautista avatar Gilson Filho avatar Bruno Pereira Gomes avatar Norbert Kapica avatar Igor P. Leroy avatar  avatar Alexey K. avatar Pablo Oubiña avatar Pedro Canterini avatar Ben Beecher avatar Pratik avatar Matías Agustín Méndez avatar Eric Eldredge avatar Austin Whittier avatar RFoncier avatar Rodrigo Amaro avatar  avatar Artem Zinoviev avatar Chase Lee avatar William Ratcliff avatar

Watchers

 avatar Moises Brenes avatar Danil Ivanov avatar James Cloos avatar Tony Lattke avatar  avatar Luis Angel Reyes Bautista avatar  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.