1. How do you install?
It's pretty easy to install just using the tutorials that you can find. There's a free Django book at www.djangobook.com. That includes all the info you need. [installing django, django book]
2. How do you start developing?
Django comes with a development server, so you don't have to set up a server and everything. It's easy to follow the tutorials and get the server running and see the administrative interface which is automatically provided by Django. [django start, django server, django setup]
(Problem) I had a problem, I moved around one of the folders which included some django stuff, it was the django-trunk. After that nothing worked and I had to take everything out and try to figure it out again. [problem, django setup, python, django]
To develop:
1. Set up the project.
First set up the project by running the command: django-admin.py startproject nameofyourproject
(If you get an error "-bash: django-admin.py: command not found", your django-admin.py isn't in your system path (don't ask me what that means exactly...). You have to options to remedy the problem:
- Faster, but not a long-term solution: instead of django-admin.py write the whole path to where your django installation resides, for example, the whole command to start a project would become: /Home/MyProgramming/django-trunk/django/bin/django-admin.py startproject nameofyourproject
- A better solution is to move your django-admin.py to your system path. I got it done by writing: sudo ln -s /Home/MyProgramming/django-trunk/django/bin/django-admin.py /usr/bin/django-admin. After that it worked to just write django-admin.py startproject nameofmyproject to get the project started.
Configure the database by adding the necessary information to the nameofproject/settings.py -file. If you're a beginner, just put in 'sq3lite' in the database_engine and define a file for the database in you project in database_name, for example '/Programming/Django/nameofmyproject/mydata.db'
3. Create an app in the project: python manage.py startapp nameofyourapp
This creates an application directory under your project. You have to use apps if you want to use models in Django.
4. Create a model in the models.py file under the app directory
It could look something like this (in the nameofmyproject/nameofmyapp/models.py file):
from
Somewhat answered questions:
3. How do you make graphics with Django?
It seems graphics can be made just by CSS and HTML since Django only adds some stuff to the HTML page. So I'll still have to learn CSS again.
No comments:
Post a Comment