1. Create A Project
pip install django
django-admin startproject {Project Name}
2. To Check Everything is Fine Till here
python manage.py runserver
3. Pass Commands in terminals
python manage.py startapp {App Name}
4. Create A File in App Folder (urls.py)
copy code from project's urls.py file Check Here
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name="home-load"),
]
5. project's urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('{App Name}.urls') ),
]
6. Create Folder templates/something
7. Create An Index File
8. in Views.py
def home(request):
return render(request,'myapp/index.html')
9. from apps.py copy class name
10. open settings.py add installed apps as
'AppName.apps.classname'
Tags:
Python
'AppName.apps.classname'
ReplyDelete