Everything is ready to roll. Just add your app folder inside the project or start a new one with the following command:
pip install -r requirements.txt
python manage.py startapp <your_app_name>
And add it to the settings.py
file.
INSTALLED_APPS = [
'accounts',
'guest_user',
<your_app_name>
]
Add .env
file to the root of your project.
Add SECRET_KEY
variable to the the .env
file.
SECRET_KEY=your_secret_key
Finally, run the following command:
python manage.py migrate
Install requirements.txt.
pip install -r requirements.txt
Copy the accounts
folder and paste it to your project.
Install them on your project as well as the guest_user
module for Guest-Login functionality.
INSTALLED_APPS = [
...
'accounts',
'guest_user',
...
]
Add the following line into the AUTHENTICATION_BACKENDS
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend",
# it should be the last entry to prevent unauthorized access
"guest_user.backends.GuestBackend", #new line
]
Add url routing in urls.py
for the guest and user authentication applications.
urlpatterns = [
# ... other patterns
path("accounts/", include("accounts.urls")),
path("guest/", include("guest_user.urls")),
]
Last but not least, prepare the guest user table by running migrations.
python manage.py migrate
Guest User
Functionality Has Been Implemented From This Module