3👍
First of all
Your Django version is not compatible with Python 3.7
So make these changes
In your Dockerfile
FROM python:3.6
Restart docker using sudo service docker restart
then sudo docker-compose up --build
or
sudo docker-compose run web python manage.py migrate
and sudo docker-compose up --build
0👍
It seems that you are trying to run sample from byob-profiles-rest-api.
- This example is pretty old and you have to down grade your versions:
Change your Django version to 1.11 to avoid error
ModuleNotFoundError: No module named ‘django.core.urlresolvers’
Change your Python version to 3.6
SyntaxError: Generator expression must be parenthesized
- You files should now look like this
Dockerfile
FROM python:3.6
ENV PYTHONBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY . /code/
RUN pip install -r requirements.txt
requirements.txt
appdirs==1.4.3
Django==1.11
djangorestframework==3.6.2
packaging==16.8
pyparsing==2.2.0
pytz==2017.2
six==1.10.0
- Delete the old image of byob-profiles-rest-api
- Recreate the image by running
docker-compose run web python src/profiles_project/manage.py migrate
You should see that there’s no more errors.
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying profiles_api.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying authtoken.0001_initial... OK
Applying authtoken.0002_auto_20160226_1747... OK
Applying profiles_api.0002_profilefeeditem... OK
Applying sessions.0001_initial... OK
- Build and start the server
sudo docker-compose up –build
- [Django]-Summing up values from database in DJANGO template
- [Django]-How can I post data into test Client post request?
- [Django]-SAML SSO Authentication with Django REST Framework
- [Django]-SIMPLEST way to set up password protection for a static site?
- [Django]-How to query all model objects except the ones that already are in another model?
Source:stackexchange.com