I am trying to integrate Travis CI with Django application. But I am getting the following error
Successfully built 9b60427cea1c
Successfully tagged 3_recipe_app_app:latest
WARNING: Image for service app was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating 3_recipe_app_app_run ...
System check identified no issues (0 silenced).
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
./app/settings.py:23:80: E501 line too long (81 > 79 characters)
./app/settings.py:89:80: E501 line too long (91 > 79 characters)
./app/settings.py:92:80: E501 line too long (81 > 79 characters)
./app/settings.py:95:80: E501 line too long (82 > 79 characters)
./app/settings.py:98:80: E501 line too long (83 > 79 characters)
ERROR: 1
The command "docker-compose run app sh -c "python manage.py test && flake8"" exited with 1.
Done. Your build exited with 1.
.travis.yml
language: python
python:
- "3.6"
services:
- docker
before_script: pip install docker-compose
script:
- docker-compose run app sh -c "python manage.py test && flake8"
.flake8
[flake8]
exclude =
migrations
__pycache__,
manage.py,
settings.py
Dockerfile
FROM python:3.7-alpine
LABEL maintainer="hans"
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt
RUN mkdir /app
WORKDIR /app
COPY ./app /app
RUN adduser -D user
USER user
docker-compose.yml
version: "3"
services:
app:
build:
context: .
ports:
- "8000:8000"
volumes:
- ./app:/app
command: >
sh -c "python manage.py runserver 0.0.0.0:8000"
I am not sure how this error occured. I tried this in several times but still the same error throws up. How can I solve this. Thanks in advance
CodePudding user response:
Well... you've configured the flake8 linter to be run on your code.
The linter has been configured to consider lines longer than 79 characters (the default) to be too long, and your settings file contains such lines:
./app/settings.py:23:80: E501 line too long (81 > 79 characters)
./app/settings.py:89:80: E501 line too long (91 > 79 characters)
./app/settings.py:92:80: E501 line too long (81 > 79 characters)
./app/settings.py:95:80: E501 line too long (82 > 79 characters)
./app/settings.py:98:80: E501 line too long (83 > 79 characters)
Shorten those lines, or configure flake8 to allow longer lines.