Fixtures are great ways to include test data with your application so it can be easily ported and tested. If you have an app with Fixtures included and can't seem to get it working, perhaps it's because you have not...
If your like me, you spend time moving your code between your test and production servers. This can easily complicate issues when you have hard coded full paths in your applications. There is an easy way to solve this issue...
Let's active the awesome admin area in Python's Django today! 3 easy steps to a great backend! 1. Add the following line to your settings.py file, right under INSTALLED_APPS (this is usually just commented...
Day two of working with Django, I think I am loving it. It seems so simple and clean. Plus, I have always favored Python a little, just never had it in me to start playing with it. Want to try it out yourself? Follow me to Python-land!
I assume the following:
Now I have also fallen in love with a great Python addition called virtualenv. It basically creates a virtual environment for you to complete your Python project in (allowing you to install modules needed on a project specific basis), Sweet. Let’s add that to the list of things I expect from you:
Okay, you’ve got all that, now let me share with you how I start a project.
1. Create my virtualenv instance:
>>virtualenv --system-site-packages /Users/user/Sites/env/project_name
Do this if you decided to install virtualenv, I decide to keep the files in my Sites folder, just so everything is tidy for me – but you can place your virtual environments anywhere you like. Also, the flag --system-site-packages
includes the python packages you have preinstalled, I would recommend using it.
2. Change into the directory you just created
>>cd /Users/username/Sites/env/project_name
3. Activate your virtualenv instance
>>source bin/activate
You are now running a separate instance of python, anything you install here will not be usable with other instances of pyton. You will notice your path changes to include the name of your project in parenthesis directly before your machine name as well.
4. Move into directory where you would like to create your project
5. Create project
>>django-admin.py startproject project_name
6. Move into directory that you just created
7. Edit your settings.py file to include your database settings
>>vi settings.py
8. Do the database sync to populate tables your application needs
>>python manage.py syncdb
9. Start the built in, handy dandy, web server
>>python manage.py runserver
Ta-da! Mission: Accomplished…