This post is supposed to carry on from setting up a Django app on Heroku with MongoDB and help fill in a hole from the MongoDB Tumblelog tutorial. The biggest question is, what is my directory structure? The tutorial jumps around a lot, assuming that you already know where everything should go. So let's tackle that first.
What is the structure of my Django project?
This is probably the only part that most people starting out that are familiar with programming but not Django or the web will need. Here is what your directory structure for a Tumblelog should look like:
djangoapp/ |- .git/ |- .gitignore |- venv/ |- requirements.txt |- Procfile |- djangoapp/ |- __init__.py |- urls.py |- settings.py |- manage.py |- tumblelog/ |- models.py |- views.py |- tests.py |- forms.py |- media/ |- robots.txt |- js/ |- img/ |- css/ |- templates/ |- base.html |- _form.html |- tumblelog/ |- post_detail.html |- post_list.htmlIf you fit that first description then this is all you probably wanted, so happy web app'ing!
How do I configure it?
2 import os 3 #Tons of Code 49 # Absolute filesystem path to the directory that will hold user-uploaded files. 50 # Example: "/home/media/media.lawrence.com/media/" 51 MEDIA_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../media/') 52 53 # URL that handles the media served from MEDIA_ROOT. Make sure to use a 54 # trailing slash. 55 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" 56 MEDIA_URL = '/media/'and that's it. Media to serve for all! Just watch out, there's not a lot of space on Heroku for something like images. So you'll be better off hosting images elsewhere (photobucket, flickr, picasa, etc.) and embedding the tags in your posts.
Hopefully that helps in some fashion!