Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I just got started on some web development, and got my feet wet by creating a basic facebook app using Django. I am thinking of publishing the app, and consequently now need a development app that I could make subsequent changes to and roll them out to the production app. I'm completely new to this, and would be really thankful if someone could guide me on how I could go about this, and what the best practices are. (I also plan on letting my friend contribute to the app, so I would need to integrate git or some other vcs in the process right?)

Thanks!

share|improve this question

migrated from stackoverflow.com Aug 31 '11 at 4:03

This question came from our site for professional and enthusiast programmers.

    
I was looking for Django specific solutions (how to have separate settings.py files, what to do with the databases etc). If someone can point me to a site which has this information, that would be great too! If it still is pretty open ended, I can move it to the other site. Thanks for your reply :) –  iman453 Aug 31 '11 at 3:35
    
check out the Django book, also ask your question in the question, not in the comments area. –  rosh Aug 31 '11 at 3:38

3 Answers 3

Example .gitignore file here: Recommended .gitignore file for Python projects?

I like to do something like this in my settings file:

import os

# Get the path where ever you're project is at:
PROJECT_PATH = os.path.join(os.path.dirname(__file__))

# I sometimes use the path to determine if my project is in production.
# This would not be nice for open source projects.
if PROJECT_PATH.startswith('/var/django/'):
    PRODUCTION = True
    DEBUG = False
else:
    PRODUCTION = False
    DEBUG = True


MEDIA_ROOT = PROJECT_PATH + '/media/'
MEDIA_URL = '/media/'

STATIC_ROOT = PROJECT_PATH + '/static/'
STATIC_URL = '/static/'

ADMIN_MEDIA_PREFIX = '/static/admin/'

TEMPLATE_DIRS = (
    PROJECT_PATH + '/templates/',
)

# You can add local_settings.py to .gitignore.
try:
    import local_settings
except:
    pass
share|improve this answer

I'm a newbie myself and I feel your pain. What I can say is that top-down learning is painful and a safer way to go is to start from the basics. For beginning web development, Facebook is relatively complicated and full of APIs, as is Django (and Google app engine if you decide to lump that in too). All that aside, Subversion, Github, Google Code, Beanstalk are good version-control software. They have excellent guides online. I recommend using a local development server like MAMP or WAMP to point your canvas urls to, so you can save time and money and security problems by developing locally until you are ready to host it somewhere. Facebook's developer app (a web application that is more of a html form than a web application) allows you to do this.

I recommend starting with the javascript sdk for facebook, as it is the easy to learn for python. See the Run With Friends Canvas App or the sample template code for Python (run by Google App Engine)

share|improve this answer

For developement Arnar has it, convention is to put your dev settings in a 'local_setttings.py' and import that in your settings.py.

Fabric is very popular for deployment. One command deploys and can set up your production environment.

In addition python project management is made easy by pip/virtualenv. http://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/ Shows the full processes using virtualenv/fabric/pip

This is a great tutorial that shows you how to go from nothing to production http://www.foxhop.net/django-virtualenv-apache-mod_wsgi

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.