Heroku is a free (for basic usage) web hosting site.
For my school's math club, we needed something simple and free to post a fund-raising app and I decided that putting up an Aspen site on Heroku would be a good idea. Now that the site's up and I have ironed out those gory details, I am very happy with the results. Here are some of those details:
- To use Heroku and Python in conjunction you need python-virtualenv. So make sure you get it online or run a
pip install virtualenv
, or aapt-get install python-virtualenv
. - After you create a site using Heroku, you will have to link up git and login to Heroku (this is described on Heroku's site). Next be sure to start up your Python virtualenv.
- When you're in the virtualenv, run
pip install aspen
. - Next, run
pip freeze > requirements.txt
, which will tell Heroku what Python dependencies are needed server-side. - Alright, this is the tricky part. You now need to create a file called ProcFile in your Heroku project's root directory. This file's contents should be:
web: aspen -p . -w www -a :$PORT
- That line tells Heroku to make the ProcFile's directory the project's root directory and to run Aspen over whatever port Heroku chooses. You now need to make a directory called "www" which will contain all your code files. Of course, you can call this directory whatever you want, you just need to change the contents of the ProcFile (the above line) to match.
- Given a successful linking of git and Heroku, and that you are logged into Heroku, you can run
git push heroku master
which sends your Aspen pages to the web, and foreman start
which lets you test your app locally.
No comments:
Post a Comment