diff --git a/README.md b/README.md index a612531..7f94bfb 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,9 @@ Setup virtual environment and install dependencies: python3 -m venv venv source venv/bin/activate pip install -r requirements.txt -deactivate +logout ``` + Add the uwsgi configuration file, `/etc/uwsgi/apps-available/drakul.ini`: ```ini [uwsgi] @@ -67,6 +68,7 @@ Enable the application in uwsgi: ln -s /etc/uwsgi/apps-available/drakul.ini /etc/uwsgi/apps-enabled service uwsgi restart ``` + Add the following to your `/etc/nginx/sites-available/drakul.example.com`: ```text location / { @@ -79,7 +81,7 @@ location /static/ { } ``` -That's it! After restarting nginx everything should work. +That's it! After restarting nginx everything should work. The default superuser username/password is `admin`/`admin`. ### Environment variables diff --git a/drakul/base/migrations/0001_set_site_name.py b/drakul/base/migrations/0001_set_site_name.py new file mode 100644 index 0000000..11fcbd9 --- /dev/null +++ b/drakul/base/migrations/0001_set_site_name.py @@ -0,0 +1,25 @@ +# Generated by Django 2.2.6 on 2019-10-25 03:16 + +from django.db import migrations + + +def set_site_name(apps, schema_editor): + """ + https://docs.djangoproject.com/en/2.2/topics/migrations/#data-migrations + """ + Site = apps.get_model("sites", "Site") + Site.objects.create( + domain="drakul.example.com", + name="Drakul" + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ("sites", "0001_initial"), + ] + + operations = [ + migrations.RunPython(set_site_name), + ] diff --git a/drakul/base/migrations/__init__.py b/drakul/base/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/drakul/users/migrations/0002_create_admin.py b/drakul/users/migrations/0002_create_admin.py new file mode 100644 index 0000000..2d19dbb --- /dev/null +++ b/drakul/users/migrations/0002_create_admin.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.6 on 2019-10-25 03:09 + +from django.db import migrations + + +def create_admin(apps, schema_editor): + """ + https://docs.djangoproject.com/en/2.2/topics/migrations/#data-migrations + """ + # The docs says to use 'User = apps.get_model("users", "User")', but when doing that + # 'self.model.normalize_username()', which is called from create_superuser(), cannot be accessed.. + from drakul.users.models import User + User.objects.create_superuser( + username="admin", + email="admin@localhost", + password="admin" + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0001_initial'), + ] + + operations = [ + migrations.RunPython(create_admin), + ]