#31038: prevent collectstatic from trying to access a database
-------------------------------------+-------------------------------------
Reporter: SteveGZr | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 2.2
Severity: Normal | Resolution:
Keywords: collectstatic | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by SteveGZr:
Old description:
> I have a Dockerfile with a multi-stage build in which I'm trying to run
> `collectstatic` to get all the static files and copy them into the final
> docker image.
> At this moment I don't have a database to access, but as `collectstatic`
> is trying to access one with dummy values, I get an error.
>
> In my opinion there should be no need for `collectstatic` to access a
> database. I have read through other Issues concerning this, so I think
> you are not planning on changing this. That' why I need to know if there
> is any way to prevent this access to a database.
>
> Here's what I have:
> {{{
> ARG baseImage
> FROM ${baseImage} AS base
>
> USER root
>
> ENV DB_HOST="example" \
> DB_NAME="example" \
> DB_USER="example" \
> DB_PASSWORD="example"
>
> RUN python app/manage.py collectstatic --skip-checks --noinput --clear \
> && node_modules/.bin/gulp compile --destination "/tmp/staticcmp"
>
> FROM nginx:1.11 AS cdn
>
> COPY docker/cdn/etc/cdn-nginx.conf /etc/nginx/conf.d/default.template
> COPY docker/cdn/robots.txt /usr/share/nginx/html/robots.txt
> COPY docker/cdn/bin/ /usr/local/bin/
> COPY --from=base /tmp/staticcmp/ /usr/share/nginx/html/static
>
> ENV NGINX_ERROR_LOG="/dev/stdout" \
> NGINX_ACCESS_LOG="/dev/stdout"
>
> EXPOSE 8000
>
> ENTRYPOINT ["docker-cdn-entrypoint"]
New description:
I have a Dockerfile with a multi-stage build in which I'm trying to run
`collectstatic` to get all the static files and copy them into the final
docker image.
At this moment I don't have a database to access, but as `collectstatic`
is trying to access one with dummy values, I get an error.
In my opinion there should be no need for `collectstatic` to access a
database. I have read through other Issues concerning this, so I think you
are not planning on changing this. That's why I need to know if there is
any way to prevent this access to a database.
Here's what I have:
{{{
ARG baseImage
FROM ${baseImage} AS base
USER root
ENV DB_HOST="example" \
DB_NAME="example" \
DB_USER="example" \
DB_PASSWORD="example"
RUN python app/manage.py collectstatic --skip-checks --noinput --clear \
&& node_modules/.bin/gulp compile --destination "/tmp/staticcmp"
FROM nginx:1.11 AS cdn
COPY docker/cdn/etc/cdn-nginx.conf /etc/nginx/conf.d/default.template
COPY docker/cdn/robots.txt /usr/share/nginx/html/robots.txt
COPY docker/cdn/bin/ /usr/local/bin/
COPY --from=base /tmp/staticcmp/ /usr/share/nginx/html/static
ENV NGINX_ERROR_LOG="/dev/stdout" \
NGINX_ACCESS_LOG="/dev/stdout"
EXPOSE 8000
ENTRYPOINT ["docker-cdn-entrypoint"]
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31038#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.180180a9c197f7abc04eb0a84cd03ebb%40djangoproject.com.