1. Step: Verify if Django is installed:
python -c "import django; print(django.get_version())"
2. Step: Create a new project
django-admin.py startproject mysite==> mysite is the name of project
3. Step: Verify if the project was created with success
execute the web server (development)
python manage.py runserver 8080and try to access: http://127.0.0.1:8080
4. Step: Config the database into file settings.py inside of the project directory/project_name/
eg: mysite/mysite/settings.py
5. Step: Set the TIME_ZONE into the settings.py
6. Step: Create the administration databases
python manage.py syncdb
7. Step: Create a new application
python manage.py startapp polls==> polls is the name of application
8. Step: Change the INSTALLED_APPS into settings.py to include the application
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # Uncomment the next line to enable the admin: # 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'polls', )
9. Step: Include the application models into models.py inside of the application directory
10. Step: Create the new tables into the databases
python manage.py syncdb
11. Step: Test your model and database using the shell
python manage.py shell
No comments:
Post a Comment