0% found this document useful (0 votes)
3 views14 pages

Starting a Django Project Guide

This document provides a guide for starting a Django project, including creating a project directory and using the command 'django-admin.exe startproject mysite'. It outlines the files generated by the startproject command and explains the purpose of each file, as well as how to run the built-in development server with 'python manage.py runserver'. Additionally, it describes how to create a new app within the project using 'python manage.py startapp myapp'.

Uploaded by

hod.cse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views14 pages

Starting a Django Project Guide

This document provides a guide for starting a Django project, including creating a project directory and using the command 'django-admin.exe startproject mysite'. It outlines the files generated by the startproject command and explains the purpose of each file, as well as how to run the built-in development server with 'python manage.py runserver'. Additionally, it describes how to create a new app within the project using 'python manage.py startapp myapp'.

Uploaded by

hod.cse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 1

Starting a Project
Starting a Project
 A project is a collection of settings for an instance of Django, including database

configuration, Django-specific options, and application-specific settings.

 If this is your first time using Django, you’ll have to take care of some initial setup.

 Create a new directory to start working in, perhaps something like

/home/username/djcode/, and change into that directory.

 Run the command [Link] startproject mysite to create a mysite directory

in your current directory.


Starting a Project
 Let’s look at what startproject created:
 mysite/
 __init__.py
 [Link]
 [Link]
 [Link]
 These files are as follows:
 • __init__.py: A file required for Python; treat the directory as a package (i.e., a group
of modules)
 • [Link]: A command-line utility that lets you interact with this Django project in
various ways
 • [Link]: Settings/configuration for this Django project
 • [Link]: The URL declarations for this Django project; a “table of contents” of your
Django-powered site
The Development Server
 Django includes a built-in, lightweight Web server you can use while developing your

site.

 We’ve included this server so you can develop your site rapidly, without having to deal

with configuring your production Web server (e.g., Apache) until you’re ready for

production.

 This development server watches your code for changes and automatically reloads,

helping you make many rapid changes to your project without needing to restart

anything.
The Development Server
 Change into the mysite directory, if you haven’t done so already, and run the command

 python [Link] runserver.

 You’ll see something like this:

Validating models...

0 errors found.

Django version 0.96, using settings '[Link]'

Development server is running at [Link]

Quit the server with CONTROL-C.


Creating app
 python [Link] startapp myapp

 myapp/
 __init__.py
 [Link]
 [Link]
 migrations/
 __init__.py
 [Link]
 [Link]
 [Link]
Screenshots
Screenshots
Screenshots
Screenshots
Screenshots
12
13
14

You might also like