Django for Designers/Sharing: Difference between revisions

imported>Paulproteus
(→‎Deployment on Heroku: "cd" built in)
imported>Paulproteus
Line 58:
 
<source lang="bash">
web: web: bash -c "cd myproject ; exec python manage.py runserver 0.0.0.0:$PORT --noreload"
</source>
 
Make sure to put it at the ''top'' of the project directory, namely in ''django-for-designers'', not ''django-for-designers/myproject''.
 
Be sure to stage this for being committed.
 
<source lang="bash">
# in django-for-designers
$ git add Procfile
</source>
 
To configure the database, we will employ a trick at the bottom of the settings file: if we detect we are running on Heroku, we change the configuration to the one that Heroku provides.
Line 72 ⟶ 79:
import dj_database_url
DATABASES['default'] = dj_database_url.config()
</source>
 
You need to also add one line to requirements.txt so that your Python code can communicate with Heroku's databases, which run a database server called postgres. Support for this is not built-in to Python, but it is available by a module. Add that module name to your ''requirements.txt'' file:
 
<source lang="python">
psycopg2
</source>
 
Anonymous user