-
Check out the repo:
$ git clone git://github.com/blenderbox/dppl.git
-
Create a virtual environment:
$ mkvirtualenv dppl --no-site-packages
-
Enter your vitrtual environment, and install the packages:
$ workon dppl $ easy_install pip $ pip install -r requirements.txt
Note: You'll need to install memcached, and tools to install all of the requirements. For ubuntu:
$ sudo apt-get install memcached $ sudo apt-get install libmemcached-dev libmemcached-tools
-
Grab some Sass
$ gem install sass / sudo gem install sass
-
Copy settings/local.py.example to local.py, and customize with your database info:
$ cp source/settings/local.py.example source/settings/local.py
-
Create your database, then run syncdb and fake migrations:
$ python source/manage.py syncdb --all $ python source/manage.py migrate --fake
Note: Don't run fake migrations. This is bad.
-
Do some crazy shit with the shell_plus:
$ python source/manage.py shell_plus $ u = User.objects.get(pk=1) $ u.profile = Profile(team_id=1) $ u.save()
-
Give up and DM kayluhb for a db dump
-
Startup your server:
$ python source/manage.py runserver
-
The Heroku server is (currently) located at: http://dppl.herokuapp.com
-
Email djablons at blenderbox dot com to get access as a developer.
-
Install the Heroku package, and signup: http://devcenter.heroku.com/articles/quickstart
-
Once you've gained access, you can run any basic commands using:
$ heroku run "python source/manage.py <some command> --settings=source.settings.heroku"
There's also the handy script
deploy/heroku_run.sh
which will handle this for you. For this shortcut do:$ ./deploy/heroku_run.sh shell_plus --plain
Which will actually run:
$ heroku run "python source/manage.py shell_plus --plain --settings=source.settings.heroku"
-
To deploy, setup the static files, compile the sass, and push:
$ python source/manage.py collectstatic --noinput $ python source/manage.py compress $ git push heroku master
Or just run
./deploy/heroku.sh
. In order to do this, you'll need to have your AWS info setup inlocal.py
. Look atsettings/heroku.py
to get an idea of the vars, or look at the notes section below.
This article will definitely be helpful for Heroku stuff: http://devcenter.heroku.com/articles/quickstart
This one will be helpful if you're adding your own settings: http://rdegges.com/devops-django-part-3-the-heroku-way
If you're starting a new Heroku server, you'll need to set up some environment variables in order to get it working. To set up an environment variable, you must run:
$ heroku config:add MY_VARIABLE="my_value"
Here are the environment variables you'll need to add:
-
AWS_ACCESS_KEY_ID: Your AWS access id for S3 storage.
-
AWS_SECRET_ACCESS_KEY: Your AWS secret key for S3 storage.
-
AWS_STORAGE_BUCKET_NAME: The S3 bucket name you put the files in.
-
DJANGO_SETTINGS_MODULE: This should probably be
source.settings.heroku
unless you use a different settings file.
Once you've pushed to Heroku, you'll have to remotely run syncdb. To do this:
$ heroku run "python source/manage.py syncdb --all --noinput --settings=source.settings.heroku"
$ heroku run "python source/manage.py createsuperuser --settings=source.settings.heroku"
You'll also have to run collect static, and compile the sass locally. Heroku at this time doesn't support remote compression of SASS files. $ python source/manage.py collectstatic --noinput $ python source/manage.py compress
These
instructions,
worked for me. I followed them up to the virtualenvwrapper
installation, then added this line to my ~/.bashrc (or ~/.zshrc) file,
after my PATH declarations.
source /usr/local/share/python/virtualenvwrapper.sh