Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Django cleanup #97

Merged
merged 2 commits into from
Mar 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion populate_development_env.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# This might be dangerous... I once accidently flushed production lol.
# echo "Flushing Django database..."
# docker-compose exec django python manage.py flush --no-input

Expand All @@ -10,4 +11,4 @@ echo "Populating Django database..."
docker-compose exec django python manage.py loaddata lovelace_django_dumpdata.json

echo "Collecting static files..."
python manage.py collectstatic --no-input
docker-compose exec django python manage.py collectstatic --no-input
6 changes: 3 additions & 3 deletions src/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN pip install --upgrade pip &&\
pip install -r requirements.txt

# copy entrypoint-prod.sh
COPY ./entrypoint.prod.sh $APP_HOME
COPY ./entrypoint.sh $APP_HOME

# copy project
COPY . $APP_HOME
Expand All @@ -42,5 +42,5 @@ RUN chown -R app:app $APP_HOME
# change to the app user
USER app

# run entrypoint.prod.sh
ENTRYPOINT ["/home/app/django/entrypoint.prod.sh"]
# run entrypoint.sh
ENTRYPOINT ["/home/app/django/entrypoint.sh"]
13 changes: 0 additions & 13 deletions src/entrypoint.prod.sh

This file was deleted.

12 changes: 0 additions & 12 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,4 @@ then
echo "PostgreSQL started"
fi

echo "Flushing Django database..."
python manage.py flush --no-input

echo "Migrating Django changes..."
python manage.py migrate --no-input

echo "Populating Django database..."
python manage.py loaddata lovelace_django_dumpdata.json

echo "Collecting static files..."
python manage.py collectstatic --no-input

exec "$@"
2 changes: 1 addition & 1 deletion src/lovelace/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class CustomRegistrationForm(RegistrationForm):
"""
Subclass of ``RegistrationForm`` that enforces case-insensitive unique usernames
Subclass of `RegistrationForm` that enforces case-insensitive unique usernames
and unique email addresses.
"""
def __init__(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion src/lovelace/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
EMAIL_USE_TLS = True
# EMAIL_USE_SSL = True

# These are used by send_mass_email.py
# These are used by the send_mass_email.py custom command
LOVELACE_FROM_EMAIL = os.environ.get("LOVELACE_FROM_EMAIL")
MAILGUN_API_URL = os.environ.get("MAILGUN_API_URL")
MAILGUN_API_KEY = os.environ.get("MAILGUN_API_KEY")
Expand Down
7 changes: 0 additions & 7 deletions src/lovelace/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,10 @@
from django.shortcuts import render, redirect

from django_registration.backends.activation.views import RegistrationView
# from django_registration.views import RegistrationView

from .forms import CustomRegistrationForm
from users.models import UserProfile

# from django.contrib.auth import login
# from django.core.exceptions import ValidationError
# from django.shortcuts import render, redirect
# from django.contrib.auth import login, authenticate


logger = logging.getLogger('django.' + __name__)


Expand Down
10 changes: 1 addition & 9 deletions src/lovelace/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
WSGI config for lovelace project.

It exposes the WSGI callable as a module-level variable named ``application``.
It exposes the WSGI callable as a module-level variable named `application`.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
Expand All @@ -11,14 +11,6 @@

from django.core.wsgi import get_wsgi_application

# Development
# sys.path.append('/lovelace/lovelace-website/src/')
# sys.path.append('/lovelace/envs/website/lib/python3.7/site-packages/')

# Production
sys.path.append('/var/www/projectlovelace.net/lovelace-website/src/')
sys.path.append('/var/www/projectlovelace.net/lovelace_website_env/lib/python3.7/site-packages/')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lovelace.settings")

application = get_wsgi_application()
96 changes: 0 additions & 96 deletions src/templates/temporary/tutorial_1.html

This file was deleted.

38 changes: 0 additions & 38 deletions src/templates/temporary/tutorials.html

This file was deleted.