##virtual env
workon hpflask
pip install -r path/to/requirements.txt
##manage.py
###Runserver ./manage.py runserver
###Postgres
Start postgres if its not already running
python manage.py migrate
python manage.py syncdb
Terminal psql
psql
connect to database
\c
create database
create database databasename;
List database entries
\l
Quit
\q
Drop(delete a table) Sometimes this needs to be done before you can migrate to another database
drop table hpflsk_event;
Create postgis extension
CREATE EXTENSION postgis;
###Run tests ./manage.py test
Run tests from a specified file
./manage.py test hpflsk/tests/test_user.py
or a specified class
hpflsk/tests/test_user.py:TestUser.test_user
###Nose Tests http://ivory.idyll.org/articles/nose-intro.html
###Heroku
-
Clone the app from a repo if you are contributing to an existing app
-
Create a new app with heroku apps:create example
-
Get info on app heroku pg
-
toolbelt
-
Login
heroku login
-
View info
heroku info --app hpflask3-test
-
Connect to one dyno
heroku run bash
Now you can run commands and query the server database
-
Create a CLI function
See https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
-
Run the command with
python manage.py command args
##Django Shell
python manage.py shell
Now you can run commands on your test server.
##Test Server After starting the server got to http://127.0.0.1:8000/ login