-
Notifications
You must be signed in to change notification settings - Fork 1
HowTo's
Close any Django server instances you have running; otherwise, you will not be able to
drop the database.
Then, enter the psql
prompt, and do the following:
postgres=# \l // See who owns the database; in this case, hmu
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
hitmeup | hmu | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
...
postgres=# drop database hitmeup;
postgres=# create database hitmeup owner hmu; // Depending on who owned it
postgres=# \q
Then, migrate via ./manage.py migrate
.
If you're missing pip-sync
, pip-diff
, or git-clean-branches
, check here.
# WHILE FEATURE_NOT_COMPLETED
# Incoming update step
$ git pull # always pull, less conflicts!
$ pip-sync # make sure package requirements match up
$ ./manage.py migrate # apply any existing migrations
# Installation step
$ pip install package_name # install a package if you need it
$ pip-diff # check changes to requirements.txt
$ pip freeze > requirements.txt # update requirements.txt if needed
# Coding step
... # make some code changes
$ ./manage.py makemigrations # make migrations and apply them if needed
$ ./manage.py migrate
... # maybe write some tests
# Outgoing update step
$ git add -A # add all the files you changed
$ git commit -am "commit message" # make a commit
$ git push -u origin HEAD # always push, less conflicts!
# ENDWHILE
$ git checkout -b feature-name # check out a new branch
$ ./manage.py startapp feature_name # make a new app (unless it doesn't make sense, e.g. bugfix)
$ ./manage.py scaffoldapp feature_name # scaffold the app with folders if necessary
# === workflow loop ===
$ hub pull-request # if you have hub installed; otherwise,
# manually create a pull request
# Get it pulled in!
$ git-clean-branches # toss the old branch, since it's merged into master now
To manually create a pull request, go here.
Then, assign one or two people to the pull request. It's preferable if the assignee(s) are not in the same team as you. Assign one as primary under "Assignee," and one as secondary by an @mention in a comment.
$ git checkout feature-name # check out the feature branch
$ ./manage.py scaffoldapp feature_name # scaffold the app with folders if necessary
# === workflow loop ===
# Get it pulled in!
$ git-clean-branches # toss the old branch, since it's merged into master now
This runs a server that listens on all public IP addresses, which is useful for viewing your site from a mobile device, a friend's iPad, your boss' laptop, etc.
./manage.py runserver 0.0.0.0:8000
Then, find out what your public IP address is. Afterwards, in your other device's browser, navigate to that IP address with port 8000
. For example, if my public IP was 123.45.678.910
, then I would visit 123.45.678.910:8000
in another browser.
This sets up a Heroku development Heroku app for you, if you want to test out bleeding-edge features before deploying to production.
NOTE: Setting up a dev box will require you to specify an app name using the -a
arg for all commands when using the Heroku command line toolbelt.
# Fork the app to a new one, name up to you. "sudowoodo-hitmeup-dev-echan" used in this example.
$ heroku fork --from sudowoodo-hitmeup --to sudowoodo-hitmeup-dev-echan
# Set the secret key to one not used in production.
$ heroku config:set -a sudowoodo-hitmeup-dev-echan HMU_SECRET_KEY=wUYtJvCbBql8oH9pEjcJl4he0AgNjeTak5Z6UKDCYbTy3rAkFb
# Enable heroku-buildpack-multi to allow installation of npm dependencies.
$ heroku buildpacks:set -a sudowoodo-hitmeup-dev-echan https://github.com/heroku/heroku-buildpack-multi.git
# Add the remote to your app.
$ heroku git:remote -a sudowoodo-hitmeup-dev-echan -r dev
# Push to your current branch to dev box remote's master branch.
$ git push dev HEAD:master
# Don't forget to migrate!!!
$ heroku run -a sudowoodo-hitmeup-dev-echan ./manage.py migrate
If you need to reset the Heroku database to its pristine state.
$ heroku pg:reset DATABASE_URL # DANGEROUS! Be careful.
$ heroku run ./manage.py migrate # run migrations
$ git checkout master
$ git push heroku
$ heroku run ./manage.py migrate # Don't forget to migrate!!!