-- OR --
IMPORTANT: Startup may take up to 10s due to cold start.
| EMAIL ADDRESS | PASSWORD | STAFF STATUS |
|---|---|---|
| [email protected] | 1 | Yes |
| [email protected] | 1 | No |
Visit /admin to access Django admin interface.
Steps to deploy a Django app with an SQLite database to the App Engine standard environment:
- add
app.yamlto root - update
settings.py: allowed hosts, trusted origins and database initialization - run
python manage.py collectstatic - run
gcloud app deploy
The key is to have init-db.sqlite3 deployed to the App Engine /tmp directory, which is writable.
This allows for a prepopulated database that resets with each new instance.
Instances can scale down to zero when not in use.
The init-db.sqlite3 file contains only the user data as shown above.
https://dev.azure.com/PRA23-Tim5/_git/Infoeduka%20project
⬇ Original README ⬇
Potreban je Python 3.8 ili noviji za Django 4.2. Više na: How to install Django
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver
Nakon dodavanja modela potrebno je napraviti migraciju i spremiti ju u bazu podataka:
python manage.py makemigrations
python manage.py migrate
Nakon izmjene modela najlakše je izbrisati bazu i migracije te započeti iznova.
Predavači su Useri.
Administratori su Superuseri (Useri sa is_staff=True i is_superuser=True)
Provjera administratora u kodu se provjerava sa user.is_staff.
Više na: Using the Django authentication system i django.contrib.auth
| USERNAME | EMAIL ADDRESS | FIRST NAME | LAST NAME | STAFF STATUS | PASSWORD |
|---|---|---|---|---|---|
| [email protected] | [email protected] | AdminIme1 | AdminPrezime1 | Yes | 1 |
| [email protected] | [email protected] | PredavacIme1 | PredavacPrezime1 | No | 1 |
python manage.py shell
from django.contrib.auth.models import User
User.objects.create_superuser(username="[email protected]", email="[email protected]", first_name="AdminIme1", last_name="AdminPrezime1", password="1")
User.objects.create_user(username="[email protected]", email="[email protected]", first_name="PredavacIme1", last_name="PredavacPrezime1", password="1")
python manage.py createsuperuser