diff --git a/populate_development_env.bash b/populate_development_env.bash index bd68be4..e174c06 100644 --- a/populate_development_env.bash +++ b/populate_development_env.bash @@ -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 @@ -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 diff --git a/src/Dockerfile.prod b/src/Dockerfile.prod index 919e035..6c1b3c5 100644 --- a/src/Dockerfile.prod +++ b/src/Dockerfile.prod @@ -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 @@ -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"] \ No newline at end of file +# run entrypoint.sh +ENTRYPOINT ["/home/app/django/entrypoint.sh"] diff --git a/src/entrypoint.prod.sh b/src/entrypoint.prod.sh deleted file mode 100755 index f719b8f..0000000 --- a/src/entrypoint.prod.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -if [ "$DATABASE" = "postgres" ] -then - while ! nc -z $SQL_HOST $SQL_PORT; do - echo "Waiting for postgres..." - sleep 1 - done - - echo "PostgreSQL started" -fi - -exec "$@" diff --git a/src/entrypoint.sh b/src/entrypoint.sh index eed196a..f719b8f 100755 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -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 "$@" diff --git a/src/lovelace/forms.py b/src/lovelace/forms.py index 420333e..a418979 100644 --- a/src/lovelace/forms.py +++ b/src/lovelace/forms.py @@ -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): diff --git a/src/lovelace/settings.py b/src/lovelace/settings.py index 197274b..eb4d0cd 100644 --- a/src/lovelace/settings.py +++ b/src/lovelace/settings.py @@ -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") diff --git a/src/lovelace/views.py b/src/lovelace/views.py index 55b332f..8ae6647 100644 --- a/src/lovelace/views.py +++ b/src/lovelace/views.py @@ -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__) diff --git a/src/lovelace/wsgi.py b/src/lovelace/wsgi.py index a0fdbfb..b11ff8e 100644 --- a/src/lovelace/wsgi.py +++ b/src/lovelace/wsgi.py @@ -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/ @@ -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() diff --git a/src/templates/temporary/tutorial_1.html b/src/templates/temporary/tutorial_1.html deleted file mode 100644 index 4149ab1..0000000 --- a/src/templates/temporary/tutorial_1.html +++ /dev/null @@ -1,96 +0,0 @@ -{% extends "problems/problem.html" %} - -{% block problem_name %}First-order equations: The Euler method{% endblock %} - -{% block required %} -

Required math: Differential calculus.

-{% endblock %} - -{% block introduction %} - -

- The laws of nature are often written down in terms of differential equations. Everything - from the motion of a baseball and cannon shells to the quantum state of a particle and the - global ocean circulation are described in terms of differential equations. Without them, we - wouldn't be able to understand most physical phenomena! -

-

- A differential equation (DE) in a dependent variable $y(t)$ is any equation containing - $y(t)$ and its derivatives. A first-order DE only contains $y(t)$ and its first derivative - $\frac{dy}{dt}$. So one way to write a general first-order DE is - - $$ \frac{dy(t)}{dt} = f \left( t,y(t) \right) $$ -

-

- Many DE's can be solved by hand but many more cannot, making numerical/computational - solutions very useful. In this tutorial you will solve a first-order ordinary differential - equation (ODE) using Euler's method. The appendix discusses Euler's method more generally -

- - -

- The ODE given in the problem may be solved by hand however you will solve it using Euler's - method. To implement the method, the first step is to approximate the derivative by a - finite difference - - $$ \frac{\Delta P}{\Delta t} = \left( 1 - \frac{P}{K} \right) rP $$ - - where $\Delta P$ is the change in $P$ between two iterations of Euler's method and - $\Delta t$ is the time step between iterations. Explicitly writing - $\Delta P = P_{i+1} - P_i$ we can write - - $$ \frac{P_{i+1} - P_i}{\Delta t} = \left( 1 - \frac{P_i}{K} \right) rP_i $$ - - or solving for $P_{i+1}$ we get - - $$ P_{i+1} = P_i + \left( 1 - \frac{P_i}{K} \right) rP_i\Delta t $$ -

-

- We can then pick a small value for $\Delta t$ and approximate the solution starting from - $t=0$. $P(0)=P_0$ is given as an input so we can calculate - - $$ P(\Delta t) = P_1 = P_0 + \left( 1 - \frac{P_0}{K} \right) rP_0\Delta t $$ - $$ P(2\Delta t) = P_2 = P_1 + \left( 1 - \frac{P_1}{K} \right) rP_1\Delta t $$ - - and so on until you have enough of the solution as desired. The smaller you pick $\Delta t$ - to be, the more accurate your solution will be in generaly; however, it will take more - steps to compute. -

-{% endblock %} - -{% block problem_body %} -

- Let $P = P(t)$ denote the population of geese on a university campus as a function of time - (days). Then the population can be modelled by the differential equation - - $$ \frac{dP}{dt} = \left( 1 - \frac{P}{K} \right) rP \quad $$ - - with the initial condition $P(0) = P_0$, where $K$ is the "carrying capacity" or the - maximum number of geese the campus may sustain according to the model, and $r$ is the - growth rate of the geese. $P_0$ is the initial geese population at time $t=0$. -

-

- The university would like to keep the population at a reasonable level and so it's your job - to predict when the goose population will reach half the carrying capacity $(K/2)$. -

-{% endblock %} - -{% block input_description %} -

Values for $K$, $r$, and $P_0$.

-{% endblock %} - -{% block input_example %} - K r P_0
- 800 4.5 150 -{% endblock %} - -{% block output_description %} -

- The number of days (rounded down to the nearest integer) on which the population reaches - $K/2$. -

-{% endblock %} - -{% block output_example %} - 37 -{% endblock %} diff --git a/src/templates/temporary/tutorials.html b/src/templates/temporary/tutorials.html deleted file mode 100644 index d73fe67..0000000 --- a/src/templates/temporary/tutorials.html +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "base.html" %} - -{% block body %} -

Tutorials

- -

Ordinary differential equations

- - - - - - - - - - - - - - - - - - - - - - -

ID#

Tutorial title

T1

-

First-order equations: The Euler method, Cancerous equations

-

T2

-

Coupled first-order equations, Crabs and ants for Christmas

-
-

T3

-
-

Second-order equations, Projectile motion

-
-{% endblock %}