This is a simple Django application for user authentication, including registration, login, logout, and protected views.
- User Registration
- User Login
- User Logout
- Protected Pages (accessible only to logged-in users)
auth_app/migrations/templates/auth_app/base.htmlindex.htmllogin.htmlregister.htmlprotected.html
__init__.pyadmin.pyapps.pyforms.pymodels.pytests.pyurls.pyviews.py
project_name/__init__.pysettings.pyurls.pywsgi.py
manage.py
-
Clone the repository
git clone https://github.com/Dimplektech/Authentication_App.git cd auth_project_folder -
Create and activate a virtual environment
python -m venv auth_venv source auth_venv/bin/activate # On Windows use `auth_venv\Scripts\activate`
-
Install dependencies
pip install -r requirements.txt
-
Apply migrations
python manage.py migrate
-
Create a superuser
python manage.py createsuperuser
-
Run the development server
python manage.py runserver
-
Access the application Open your browser and go to
http://127.0.0.1:8000/.
index: Renders the index page.register: Handles user registration using the built-inUsermodel.login_view: Handles user login using the built-inUsermodel.logout_view: Handles user logout.protected_view: Renders a protected page that requires authentication.
UserRegisterForm: ExtendsUserCreationFormto include an email field. This form uses Django's built-inUsermodel.
base.html: Base template that other templates extend.index.html: Home page.login.html: Login page.register.html: Registration page.protected.html: Protected page.
- Defines URL patterns for the authentication views.
This project uses Django's built-in User model for authentication. The User model is part of django.contrib.auth and provides a standard way to handle users, including fields for username, email, password, and more.
- Django
- Python 3.x
- Dimpal Kaware (https://github.com/Dimplektech)