Django-1
Django-1
Django
Dr.S. Priya/AP-III/ICT
– Django takes care of the difficult stuff so that you can concentrate on building your web applications
• After vitrual environment is created in Command (cmd) prompt -> for remaing part move
on to VS code.
• VS Code:
– Select the virtual environment folder.
– change the interpreter path:
ü create one temporary python file like
– new file -> pythonfile -> ‘test.py’
» bottom shows the python version -> click that version -> small pop window will be opened
» select Find option
» open scripts folder -> select the python file -> select interpreter
» some times the virtual environment not get activated
» giveCSE 313 Cryptography
permission and Network Security
in power shell
Programming in C
17-Apr-23 CSE 304 Python programming By Dr.S.Priya 8
InPowerShell
• Select PowerShell and then right click -> Run as administrator -> type the following
commands
• Get-ExecutionPolicy _List
– skows local machine -> undefined (or) restricted
• Set - ExecutionPolicy Unrestricted
– type “y” - > to give permision
3. in termnal windoe type python manage.py runserver command to start the server
4. open any web browser -> in addresss bar type the local host address ( shown in step 3)
http://127.0.0.1:8000/
• \myfirstproj\myfirstproj
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'firstapp',
]
• In path\myfirstproj\firstapp
def display(request):
return HttpResponse("<h1> Hello world </h1>")
• \myfirstproj\myfirstproj
urlpatterns = [
path('admin/', admin.site.urls),
path('',display),
]