Django in windows:Application part-1

Start a project:part 1


In first part, I have explained about how to configure Django in windows.Now in this post, we will looking into application development with django in windows environment.I have configured my Django1.6.2 in C drive.To build a django application,first we initiate a project folder.Once we can start developing our application.

Initiate a Django project

First to your Django installation folder i.e C:/Django1.6.2 in my case.Open this file using “cmd” , and go to C:\Django-1.6.2\django\bin\ than type dir”, you can locate django-admin.py

C:\Django-1.6.2\django\bin>dir Directory of C:\Django-1.6.2\django\bindaily_cleanup.py
django-2to3.py
django-admin.py
<DIR> mydjango
profiling
unique-messages.py
C:\Django-1.6.2\django\bin>
Now type >python django-admin.py
C:\Django-1.6.2\django\bin>python django-admin.py
Usage: django-admin.py subcommand [options] [args]
Available subcommands: flush
ages runfcgi runserver startapp startproject
(Above,only displaying few cmds)
C:\Django-1.6.2\django\bin>
To start a project we can use sub command “startproject [Your project name]It will initiate a django project with name provide by you in same directory. Later, you can copy your folder to any drive.
C:\Django-1.6.2\django\bin>python django-admin.py startproject Demoproject
A “Demoproject” named folder is created in your current directory.Check using dir cmd.Change director by typing cd Demoproject
C:\Django-1.6.2\django\bin>cd Demoproject
C:\Django-1.6.2\django\bin\Demoapp>dir
<DIR> Demoproject
manage.py
Now type >python manage.py
C:\Django-1.6.2\django\bin\Demoproject>python manage.py
Usage: manage.py subcommand [options] [args]
It will display many options & subcmds runserver

Now type we will test application server using subcmd runserver

C:\Django-1.6.2\django\bin\Demoproject>python manage.py runserver
Validating models…0 errors found
June 07, 2014 — 21:34:32
Django version 1.6.2, using settings ‘Demoproject.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

Open your browser and type the url http://127.0.0.1:8000/ ,and you will see this message.

It worked!
Congratulations on your first Django-powered page.

Great, our project environment is created.we can start developing our application.To initiate a application we can use subcmd startapp [your app name].

C:\Django-1.6.2\django\bin\Demoproject>python manage.py startapp demoapp
C:\Django-1.6.2\django\bin\Demoproject>dir
<DIR> demoapp <DIR> Demoproject
manage.py

Directory of C:\Django-1.6.2\django\bin\Demoproject\demoapp will contain,

admin.py
models.py tests.py
views.py __init__.py

Next->>>Django in windows:Application part-2

Email me when Django in windows publishes stories