Commit 6cba08e4 authored by Laura Morel's avatar Laura Morel
Browse files

Fix Django container

parent 19c85483
......@@ -11,8 +11,6 @@ WORKDIR /code
COPY . /code/
RUN python3.8 manage.py generate_secret_key
RUN python3.8 manage.py makemigrations
RUN python3.8 manage.py migrate --run-syncdb && python manage.py fill_db True
RUN python3.8 generate_secret_key.py
EXPOSE 8000
......@@ -15,9 +15,9 @@ class Command(BaseCommand):
sizes = [10, 15, 20]
def add_arguments(self, parser):
parser.add_argument('verbose', type=bool)
parser.add_argument('verbose', type=bool, nargs='?', default=False)
def fill_db(self, verbose=False):
def fill_db(self, verbose):
for sp in self.species:
if verbose:
print(sp)
......
from django.core.management.base import BaseCommand, CommandError
from django.core.management.utils import get_random_secret_key
class Command(BaseCommand):
def generate_secret_key(self):
key=get_random_secret_key()
with open(".env", "w") as f:
f.write("SECRET_KEY='%s'\n" %(key))
f.close()
def handle(self, **options):
self.generate_secret_key()
from django.core.management.utils import get_random_secret_key
key=get_random_secret_key()
with open(".env", "w") as f:
f.write("SECRET_KEY='%s'\n" %(key))
f.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment