Administration
To access the admin page of the application, follow these steps:
Enabling the Admin Interface
-
Set Environment Variable: You need to enable the admin interface by setting the environment variable
ADMIN_ENABLEDtoTrue. This can be done in your environment configuration file (e.g.,.envfile) or directly in yourdocker-compose.yml.ADMIN_ENABLED=True -
Access the Admin Page: Once enabled, you can access the admin interface at the following URL:
https://domain.com/admin/
Logging In
To log in to the admin interface, you will need an admin account. You can either change an existing user to have admin privileges or create a new user with those roles.
Changing an Existing User to Admin
-
Open Django Shell: If you are using Docker, you can access the Django shell by running the following command in your terminal:
docker exec -it yamtrack python manage.py shell -
Set Admin Privileges: Find the user you want to promote to admin. Replace
usernamewith the actual username of the user.User.objects.filter(username='username').update(is_staff=True, is_superuser=True)
Creating a New Admin User
-
Open Django Shell: As mentioned above, access the Django shell using Docker:
docker exec -it yamtrack python manage.py shell -
Create a New User: Use the following code to create a new user. Replace
new_username,new_password, andnew_emailwith the desired values.User.objects.create_user(username='new_username', password='new_password', is_staff=True, is_superuser=True) -
Log In: After creating the new user, you can log in to the admin interface using the new credentials.
Admin Interface Overview
After logging in, you will see various tables representing the different models in your database:
Here, you can view and edit data. For example, to edit an item image:
- Click on the Items entry.
- You will see a list of items. Click on the specific item you want to change.
- In the item detail view, you can update the image URL in the corresponding field.