3👍
DIRECTLY FROM THE DIRECTIONS https://devcenter.heroku.com/articles/django, once again if you read the directions and follow them you will have executed:
$pip install Django psycopg2 dj-database-url
Database settings
Next, configure the application to use Heroku’s Postgres database. The installed dj-database-url module will do everything automatically from the env.
Add the following to your settings.py:
import dj_database_url
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
You can add these lines at the end of your settings.py to continue to use sql lite locally and only postgres on heroku.
settings.py
------------------------
import dj_database_url
import os
if os.getcwd() == "/app":
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
0👍
The heroku/django deployment tutorial you have linked is still your best bet. I just deployed an existing app following through that tutorial, and skipping steps I had already done, such as:
virtualenv venv --distribute
django-admin.py startapp...
manage.py syncdb...
git init
Basically if you have already done this for your existing app DRY!
I don’t see a requirements.txt in your folder structure above so make sure you
pip freeze > requirements.txt
To make this less likely to ruin my existing code I did the following
# create a branch for testing heroku
git checkout -b heroku_test
#... follow the heroku tutorial
# add my changes
git add .
git commit -m "Heroku deployment steps"
# add the heroku remote
git remote add heroku [address]
git push heroku heroku_test:master
The last part of the push statement heroku_test:master
lets you push your local branch heroku_test
to your remote branch master
. (Otherwise heroku will just ignore the commit as it is not on the master branch).
- [Django]-Recovering from a duplicate migration in Django South
- [Django]-Best way to redirect domain based on ip address (country) in Django
- [Django]-Is there a way to install django with pip to point to a specific version of python in virtualenv