1. Django project files significance
a. manage.py => enables the django project settings path to the environmentb. settings.py => this file contains the settings of django project like debug mode, database settings, templates path, static_url path etc.,
c. urls.py this file is the controller file which maps the web url to the respective view function/class
d. wsgi.py file => this file will have the environment settings like virtual environment site-packages path, django project path. path of this wsgi.py should be included in the apache configuration file apache2.conf
e. models.py => this file will have the information models and members of the models
f. views.py => this file will have the views functions/classes
2. Django commands
django-admin start-project my_pro => Creates django projectdjango-admin startapp myapp => creates django application inside the django project
python ./manage.py runserver 127.0.0.1:8000 => runs the development server
python ./manage.py makemigrations => creates the database migration scripts
python ./manage.py migrate => applies the migrations
python ./manage.py inspectdb > model.py => Creates the models wrt to the already existing database
python ./manage.py collectstatic => collects all the static files in the django project
python ./manage.py dbshell => Opens the database shell
python ./manage.py shell => opens the django/python shell
No comments:
Post a Comment