From c62d0deb33676f8902447f12c6107c9e534b1ac8 Mon Sep 17 00:00:00 2001 From: Jukoga Date: Sun, 8 Mar 2026 12:54:11 +0100 Subject: [PATCH] Refactor UserData admin interface; enhance user registration forms and validation; update Dockerfile for static files collection --- BH/settings.py | 6 +-- Dockerfile | 4 +- .../0002_alter_blog_id_alter_post_id.py | 23 --------- templates/base.html | 3 +- templates/blog/home.html | 1 - templates/users/login.html | 1 - templates/users/logout.html | 1 - templates/users/register.html | 1 - users/__init__.py | 0 users/admin.py | 8 ++- users/forms.py | 14 +++++- users/models.py | 9 ++-- users/serializers.py | 4 +- users/views.py | 50 ++----------------- 14 files changed, 36 insertions(+), 89 deletions(-) delete mode 100644 blog/migrations/0002_alter_blog_id_alter_post_id.py create mode 100644 users/__init__.py diff --git a/BH/settings.py b/BH/settings.py index 95d5d97..9179c00 100644 --- a/BH/settings.py +++ b/BH/settings.py @@ -25,11 +25,9 @@ DEFAULT_AUTO_FIELD='django.db.models.AutoField' # Load the Env load_dotenv() -# SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.getenv('SECRET_KEY') -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False +DEBUG = os.environ.get('DEBUG', 'False') == 'True' ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'beyond-heroes.com', 'www.beyond-heroes.com'] @@ -40,7 +38,7 @@ INSTALLED_APPS = [ 'crispy_forms', 'crispy_bootstrap4', 'blog.apps.BlogConfig', - 'users.apps.UsersConfig', + 'users', 'api.apps.APIConfig', 'django.contrib.admin', 'django.contrib.auth', diff --git a/Dockerfile b/Dockerfile index 3e9c5a0..71405da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,5 +30,5 @@ EXPOSE 3030 # Define environment variable for Gunicorn ENV GUNICORN_CMD_ARGS="--bind 0.0.0.0:3030" -# Run Gunicorn server with your Django application -CMD ["gunicorn", "BH.wsgi:application"] +# Collect static files and run Gunicorn +CMD ["sh", "-c", "python manage.py collectstatic --noinput && gunicorn BH.wsgi:application"] diff --git a/blog/migrations/0002_alter_blog_id_alter_post_id.py b/blog/migrations/0002_alter_blog_id_alter_post_id.py deleted file mode 100644 index 2bdeec9..0000000 --- a/blog/migrations/0002_alter_blog_id_alter_post_id.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 5.2.9 on 2026-02-19 10:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('blog', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='blog', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='post', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - ] diff --git a/templates/base.html b/templates/base.html index b67ce7c..2ce3abc 100644 --- a/templates/base.html +++ b/templates/base.html @@ -10,6 +10,7 @@ +