The questions I've had during my learning process.

Id Question Solved at
1 How do you install? Solved
2 How do you start developing? Solved
3 How do you make graphics with Django? Solved
4 Django uses some kind of structure to tell the application where to look for links. How does this hierarchy work? What is actually put into the different files? Solved
5 What is the most basic way to add the url:s to Solved
6 What is the " '^ " thing that can be seen in the URLpatterns? Solved
7 What is the $ sign in the URLpatterns? Solved
8 If I want to embed an iframe to the app can I do it straight into the HTML? Pending
9 Are all of the URLpatterns always put into the file? Pending
10 Is it difficult to change to the production server? Pending
11 How do I really get an external CSS sheet working? Pending
12 How do I connect a new app that I've created under the project folder to the project? Pending
13 What's the development process if I want to create a new website with apps? Something discovered
14 How do you cross query models? For example, If I have a blog app and a books app, how can I show related blog posts in my books app? Pending
15 How do I take the admin interface into use? Solved
16 How do I alter the models I already have? Pending
17 How do I customize what is shown and can be edited in the admin interface? Solved
18 When I want to start developing after some time, how do I start the server and check the page etc? Pending

Thursday, 14 May 2009

How do you install and start developing?

Continuing my Learning Capture Sparks!

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 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: startproject nameofyourproject

(If you get an error "-bash: command not found", your isn't in your system path (don't ask me what that means exactly...). You have to options to remedy the problem:

  1. Faster, but not a long-term solution: instead of 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/ startproject nameofyourproject
  2. A better solution is to move your to your system path. I got it done by writing: sudo ln -s /Home/MyProgramming/django-trunk/django/bin/ /usr/bin/django-admin. After that it worked to just write startproject nameofmyproject to get the project started.
2. Configure the database

Configure the database by adding the necessary information to the nameofproject/ -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 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 file under the app directory

It could look something like this (in the nameofmyproject/nameofmyapp/ file):


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: