Notice: Undefined variable: fields in /home/vmp7bxbd1swb/public_html/blog/wp-content/plugins/wp-about-author/wp-about-author-admin.php on line 158
1.) __init__.py: This is used to mark directories in python as python package directory. To understand this, please look at the image below which is used in this live project and understand what I mean to say.
Now if you want to use views.py in urls.py using __init__.py, you may call this in urls.py as from patients_app import view.py.
2.) settings.py: Many features can be viewed in settings.py such as secret key, allowed host, debugging and installed app. If programmer has created an application inside the current folder, it needs to be included in settings.py under the section installed app. Please look at the down image and know this step more. See I have included Medical_app at the end.
It also contains a section MIDDLEWARE_CLASSES which is used for handling client server request and response. You can work with database by configuring it here. Such option is also available here. Please look at the image to understand my point of view.
3.) urls.py: This is very important file and is used for mapping between views.py and urls.py. To make you understand, let us write a simple code in views.py
from django.http import HttpResponse def aisangam(request): text = “Please visit AI Sangam for AI and excellence in Machine learning along with web integration” return HttpResponse(text) Look at the parameter request we need to supply the request so that particular response is hit. This request is provided by urls.py. from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() from url.views import hello urlpatterns = [ # url(r'^admin/', admin.site.urls), url(r'^aisangam/$', aisangam), ]
If you go to http://127.0.0.1:8000/aisangam. This is the local address of your computer which is based on apache2 server.
4.) manage.py: It performs the same thing as done by django-admin. It sets Django-setting-module environment variable to your project setting file.