Wednesday, January 4, 2017

Django - 004 - The development server

Let us verify our django project works. Change into the outer myD3site directory

~/Documents/my_d3_project/django/myD3site $ ls -lrt
total 44
-rwxr-xr-x 1 sashank sashank   806 Jan  4 18:17 manage.py
drwxr-xr-x 2 sashank sashank  4096 Jan  4 19:47 myD3site
-rw-r--r-- 1 sashank sashank 36864 Jan  4 19:47 db.sqlite3
~/Documents/my_d3_project/django/myD3site $

and run the following command:

~/Documents/my_d3_project/django/myD3site $ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
January 04, 2017 - 20:02:38
Django version 1.10.4, using settings 'myD3site.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

We have started the django development server, a lightweight webserver written purely in Python. We have included this with Django so that it is possible to develop things rapidly, without having to deal with configuring a production server - such as Apache - until you are ready for production.

Note: Do not use this server in Production Environment. This is intended for developmental use only.

Now, let us visit  the page (http://127.0.0.1:8000/) from our web browser.


You will see a welcome page in a pleasant, light-blue pastel. It worked!

Automatic reloading of runserver:
The development server automatically reloads Python code for each request as needed. You do not need to restart the server for code changes to take effect. However, some actions such as adding files do not trigger a restart. You will have to restart the server in these cases.



No comments:

Post a Comment