I like to follow this post for setting up a Django project => http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/ It explains the virtualenv setup how important source control is. When it comes to source control I prefer git, but that is just a matter of personal taste as long as you use some kind of source control…
The article also describes how to setup and use south for database migrations. This is a very nice feature since you most likely will add fields to your database models or and south makes database migrations a breeze.
Since I like to use mysql I need to install the according libraries and make the according changes in settings.py
pip install mysql-python
after this we can sync the db as described in the article.
I also like to use the admin module as interface to the database, so lets add it to the installed apps in settings.py
'django.contrib.admin',
In urls.py on top add
from django.contrib import admin admin.autodiscover()
Now we can start the development webserver, keep in mind to only use this for development and never in a production environment.
python manage.py runserver 8080
Now open your webbrowser and navigate to
http://127.0.0.1:8080/admin/
and you should see the admin login interface and be able to login.
Happy coding from here 🙂
Pingback: Django project setup with mysql and south | Yet another tech focused Blog