Django for ISchoolers: Difference between revisions

Content added Content deleted
imported>Aldeka
imported>Aldeka
No edit summary
Line 23: Line 23:
<code>
<code>
$ virtualenv --no-site-packages django-tutorial-env
$ virtualenv --no-site-packages django-tutorial-env

$ source django-tutorial-env/bin/activate
$ source django-tutorial-env/bin/activate

(django-tutorial-env)$ pip install django
(django-tutorial-env)$ pip install django

(django-tutorial-env)$ pip install south
(django-tutorial-env)$ pip install south
</code>
</code>
Line 77: Line 80:


<code>$ cd mysite
<code>$ cd mysite

$ ls
$ ls

__init__.py
__init__.py

manage.py
manage.py

settings.py
settings.py

urls.py</code>
urls.py</code>


Line 95: Line 103:


** Run the command:
** Run the command:

<code>python manage.py runserver</code>
<code>python manage.py runserver</code>


Line 100: Line 109:


<code>Validating models...
<code>Validating models...

0 errors found.
0 errors found.



Django version 1.2, using settings 'myproject.settings'
Django version 1.2, using settings 'myproject.settings'

Development server is running at http://127.0.0.1:8000/
Development server is running at http://127.0.0.1:8000/

Quit the server with CONTROL-C.</code>
Quit the server with CONTROL-C.</code>


* Now that the server’s running, visit [http://127.0.0.1:8000/ http://127.0.0.1:8000/] with your Web browser. You’ll see a “Welcome to Django” page, in pleasant, light-blue pastel. It worked!
* Now that the server’s running, visit [http://127.0.0.1:8000/ http://127.0.0.1:8000/] with your Web browser. You’ll see a “Welcome to Django” page, in pleasant, light-blue pastel. It worked!

* Observe the logging that happens in the terminal where your server is running:

<code>[24/Mar/2011 11:50:18] "GET / HTTP/1.1" 200 2057</code>

which has the format:

<code>DATE METHOD URL PROTOCOL RESPONSE_CODE CONTENTSIZE</code>

* Navigate to http://127.0.0.1:8000/some/url/. What changes in the terminal log?

* Exit the server by returning to the terminal instance where the development server is running and pressing CONTROL-C on your keyboard.


== Using version control ==
== Using version control ==