https://github.com/SimpleCyber/Django-starter-kit
Starter Kit : A beginner-friendly Django starter project with a pre-configured index page, login system, and basic user authentication.
https://github.com/SimpleCyber/Django-starter-kit
authentication-setup django starter-template
Last synced: 6 months ago
JSON representation
Starter Kit : A beginner-friendly Django starter project with a pre-configured index page, login system, and basic user authentication.
- Host: GitHub
- URL: https://github.com/SimpleCyber/Django-starter-kit
- Owner: SimpleCyber
- Created: 2024-12-26T05:10:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-26T07:47:14.000Z (over 1 year ago)
- Last Synced: 2024-12-26T08:27:31.513Z (over 1 year ago)
- Topics: authentication-setup, django, starter-template
- Language: HTML
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
1. 🌿 django-admin startproject project-name
2. open the project-name
🌿 python manage.py makemigrations
🌿 python manage.py migrate
python manage.py startapp home
3. Resister [app]
After my [app] has been created (home)
- home/apps.py
copy function name "HomeConfig"
and
paste it in the [project] (usersproject)
- usersproject/settings.py
Installed_apps= [
'home.apps.HomeConfig',
]
🌿 python manage.py startapp home
4. Allowed_hosts =[]
usersproject/settings.py
define the allowed hosts = ["http://localhost:8000, "satyam.com"]
else it will throw an error
5. create an static and templates folder
- home
- usersproject
- static
- templates
6. set static dirs in django
usersproject/settings.py
at the end paste this
STATICFILES_DIRS = [
os.path.join(BASE_DIR ,"static"),
]
7. set templates
usersproject/settings.py
update : 'DIRS': [os.path.join(BASE_DIR ,"templates"),],
# Start server : py manage.py runserver
1. Create the html files
1. templates/index.html
2. templates/login.html
2. update the userproject/urls.py
- from django.urls import path => from django.urls import path , include
- urlpatterns = [
path('admin/', admin.site.urls),
path('', include('home.urls')),
]
- [app] home
create a new file name home/urls.py : this will handle all of the home files routing
home/urls.py
from django.contrib import admin
from django.urls import path , include
from home import views
urlpatterns = [
path('', views.index, name="home"),
path('login', views.login, name="login"),
path('logout', views.logout, name="logout"),
]
- [app] home/views.py : now i need to create all of the functions too
from django.shortcuts import render, redirect
# Create your views here.
def index(request):
return render(request,'index.html')
def login(request):
return render(request,'login.html')
def logout(request):
return render(request,'index.html')