Git Product home page Git Product logo

docker-django's People

Contributors

alesandrolang avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

docker-django's Issues

Not work

I can not start the server on localhost: 8000, it does not work, What command should I have to start runserver.

Translated with google, I'm french

ModuleNotFoundError

Thank you so much for your contribution, i am quite new on docker and I faced some problems on pull the image to run it on NAS. The listed below are the log, could you give me some ideas to fix it, thanks.

ModuleNotFoundError: No module named '.wsgi'

import(module)
File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return self.load_wsgiapp()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
self.callable = self.load()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.load_wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
worker.init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
Traceback (most recent call last):
[ERROR] Exception in worker process
starting gunicorn (PORT=8000, RELOAD=false, APP=)

remove duplicate code

Description

Supporting multiple versions of django in combination with the python distributions leads to many docker tags. Each docker tag is used by one Docker Hub automated build.

Currently each version combination has its own folder which leads to duplicate code because the configuration files which are the same across versions were copied around.

Where is the django site?

Hi Alesandro,

as I understand it this image is prepared to just drop a django app, right? But where is the django site, with the settings.py, the wsgi file, etc?

It would make things probably understandable if there would be a hello world app already there that people know where to just drop the app code to not worry about the django site at all.

Thanks.

How serve static file ?

Ok, it's great, but in this solution (gunicorn tool only, no nginx), how serve the static file ?
not found: /static/admin/.....

Cannot Start Docker

Hi,

I'm using Unraid and try to start the image after downloading it. But it won't start. I checked the log and it says in the end of the log (please let me know if you need the full log):
TypeError: the 'package' argument is required to perform a relative import for '.wsgi'

Can you please help with this? (is it possible I did not set the path and variable correctly? If yes, how should I set them up?)

Thanks a lot!

Advices on doing the same thing for Django 1.6 and Python 2.7

Hey, really hope you're doing fine. Thanks a lot for this project. I'm currently working on a Django project that should be dockerized, and I was wondering if you can just give me some suggestions on how to make the project support new tags: 1.6-python2, and 1.6-python2-onbuild. Thanks a lot for your advices.

Container Refuses to Start?

I could build a version with a demo app, but when I went and actually added my real app to the environment, it stopped working. I can build without errors, but when I attempt to run, I get this error:

[FATAL tini (7)] exec ./start.sh failed: No such file or directory

Dockerfile:

FROM alang/django
ENV DJANGO_APP=lasa         
COPY ./ /usr/django/app/lasa
USER root
RUN apk --no-cache add \
    build-base \
    python3-dev \
    freetype-dev \
    fribidi-dev \
    harfbuzz-dev \
    jpeg-dev \
    lcms2-dev \
    openjpeg-dev \
    tcl-dev \
    tiff-dev \
    tk-dev \
    zlib-dev \
    postgresql-dev

USER gunicorn
WORKDIR /usr/django/app/lasa
RUN pip install pillow psycopg2
RUN mv lasa/settings.prod.py lasa/settings.py

Build command:

docker build -t foo/lasa --no-cache .

Build output:

docker build -t foo/lasa --no-cache .                  
Sending build context to Docker daemon  45.96MB
Step 1/10 : FROM alang/django
 ---> fb7a5de0b47d
Step 2/10 : ENV DJANGO_APP=lasa
 ---> Running in 9904c1a9261b
Removing intermediate container 9904c1a9261b
 ---> 62a2aeae8463
Step 3/10 : RUN mkdir -p /usr/django/app/lasa
 ---> Running in 5139d6e78275
Removing intermediate container 5139d6e78275
 ---> c2089cdccb9f
Step 4/10 : COPY . /usr/django/app/lasa
 ---> 7ee191a22de9
Step 5/10 : USER root
 ---> Running in 007b69731168
Removing intermediate container 007b69731168
 ---> 30e2a7fa7698
Step 6/10 : RUN apk --no-cache add     build-base     python3-dev     freetype-dev     fribidi-dev     harfbuzz-dev     jpeg-dev     lcms2-dev     openjpeg-dev     tcl-dev     tiff-dev     tk-dev     zlib-dev     postgresql-dev
 ---> Running in d70e0b1afa34
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/117) Installing libgcc (10.2.1_pre1-r3)
(2/117) Installing libstdc++ (10.2.1_pre1-r3)
(3/117) Installing binutils (2.35.2-r1)
(4/117) Installing libmagic (5.39-r0)
(5/117) Installing file (5.39-r0)
(6/117) Installing libatomic (10.2.1_pre1-r3)
(7/117) Installing libgphobos (10.2.1_pre1-r3)
(8/117) Installing gmp (6.2.1-r0)
(9/117) Installing isl22 (0.22-r0)
(10/117) Installing mpfr4 (4.1.0-r0)
(11/117) Installing mpc1 (1.2.0-r0)
(12/117) Installing gcc (10.2.1_pre1-r3)
(13/117) Installing musl-dev (1.2.2-r1)
(14/117) Installing libc-dev (0.7.2-r3)
(15/117) Installing g++ (10.2.1_pre1-r3)
(16/117) Installing make (4.3-r0)
(17/117) Installing fortify-headers (1.1-r0)
(18/117) Installing patch (2.7.6-r7)
(19/117) Installing build-base (0.5-r2)
(20/117) Installing brotli-libs (1.0.9-r3)
(21/117) Installing libpng (1.6.37-r1)
(22/117) Installing freetype (2.10.4-r1)
(23/117) Installing pkgconf (1.7.3-r0)
(24/117) Installing brotli-dev (1.0.9-r3)
(25/117) Installing zlib-dev (1.2.11-r3)
(26/117) Installing libpng-dev (1.6.37-r1)
(27/117) Installing freetype-dev (2.10.4-r1)
(28/117) Installing fribidi (1.0.10-r0)
(29/117) Installing fribidi-dev (1.0.10-r0)
(30/117) Installing libblkid (2.36.1-r1)
(31/117) Installing libmount (2.36.1-r1)
(32/117) Installing pcre (8.44-r0)
(33/117) Installing glib (2.66.8-r0)
(34/117) Installing graphite2 (1.3.14-r0)
(35/117) Installing harfbuzz (2.7.4-r1)
(36/117) Installing icu-libs (67.1-r2)
(37/117) Installing harfbuzz-icu (2.7.4-r1)
(38/117) Installing python3 (3.8.10-r0)
(39/117) Installing gettext-asprintf (0.20.2-r2)
(40/117) Installing gettext-dev (0.20.2-r2)
(41/117) Installing bzip2-dev (1.0.8-r1)
(42/117) Installing libxml2-utils (2.9.12-r0)
(43/117) Installing libgpg-error (1.41-r0)
(44/117) Installing libgcrypt (1.8.8-r0)
(45/117) Installing libxslt (1.1.34-r0)
(46/117) Installing docbook-xml (4.5-r6)
Executing docbook-xml-4.5-r6.post-install
(47/117) Installing docbook-xsl (1.79.2-r2)
Executing docbook-xsl-1.79.2-r2.post-install
(48/117) Installing linux-headers (5.7.8-r0)
(49/117) Installing libffi-dev (3.3-r2)
(50/117) Installing libpcre16 (8.44-r0)
(51/117) Installing libpcre32 (8.44-r0)
(52/117) Installing libpcrecpp (8.44-r0)
(53/117) Installing pcre-dev (8.44-r0)
(54/117) Installing blkid (2.36.1-r1)
(55/117) Installing libcap-ng (0.8.2-r0)
(56/117) Installing setpriv (2.36.1-r1)
(57/117) Installing libsmartcols (2.36.1-r1)
(58/117) Installing findmnt (2.36.1-r1)
(59/117) Installing mcookie (2.36.1-r1)
(60/117) Installing hexdump (2.36.1-r1)
(61/117) Installing lsblk (2.36.1-r1)
(62/117) Installing libfdisk (2.36.1-r1)
(63/117) Installing sfdisk (2.36.1-r1)
(64/117) Installing cfdisk (2.36.1-r1)
(65/117) Installing partx (2.36.1-r1)
(66/117) Installing libeconf (0.3.8-r0)
(67/117) Installing util-linux (2.36.1-r1)
(68/117) Installing util-linux-dev (2.36.1-r1)
(69/117) Installing glib-dev (2.66.8-r0)
(70/117) Installing graphite2-dev (1.3.14-r0)
(71/117) Installing icu (67.1-r2)
(72/117) Installing icu-dev (67.1-r2)
(73/117) Installing harfbuzz-dev (2.7.4-r1)
(74/117) Installing libjpeg-turbo (2.1.0-r0)
(75/117) Installing libjpeg-turbo-dev (2.1.0-r0)
(76/117) Installing jpeg-dev (9d-r1)
(77/117) Installing tiff (4.2.0-r0)
(78/117) Installing libtiffxx (4.2.0-r0)
(79/117) Installing tiff-dev (4.2.0-r0)
(80/117) Installing lcms2 (2.11-r0)
(81/117) Installing lcms2-dev (2.11-r0)
(82/117) Installing openjpeg (2.4.0-r1)
(83/117) Installing openjpeg-dev (2.4.0-r1)
(84/117) Installing llvm10-libs (10.0.1-r1)
(85/117) Installing clang-libs (10.0.1-r0)
(86/117) Installing clang (10.0.1-r0)
(87/117) Installing llvm10 (10.0.1-r1)
(88/117) Installing openssl-dev (1.1.1k-r0)
(89/117) Installing libsasl (2.1.27-r10)
(90/117) Installing libldap (2.4.57-r1)
(91/117) Installing libpq (13.3-r0)
(92/117) Installing postgresql-libs (13.3-r0)
(93/117) Installing postgresql-dev (13.3-r0)
(94/117) Installing python3-dev (3.8.10-r0)
(95/117) Installing tcl (8.6.10-r1)
(96/117) Installing tcl-dev (8.6.10-r1)
(97/117) Installing libxau (1.0.9-r0)
(98/117) Installing xorgproto (2020.1-r0)
(99/117) Installing libxau-dev (1.0.9-r0)
(100/117) Installing xcb-proto (1.14.1-r0)
(101/117) Installing libbsd (0.10.0-r0)
(102/117) Installing libxdmcp (1.1.3-r0)
(103/117) Installing libxcb (1.14-r1)
(104/117) Installing libxdmcp-dev (1.1.3-r0)
(105/117) Installing libxcb-dev (1.14-r1)
(106/117) Installing xtrans (1.4.0-r1)
(107/117) Installing libx11 (1.7.1-r0)
(108/117) Installing libx11-dev (1.7.1-r0)
(109/117) Installing libxrender (0.9.10-r3)
(110/117) Installing fontconfig (2.13.1-r3)
(111/117) Installing libxft (2.3.3-r0)
(112/117) Installing expat-dev (2.2.10-r1)
(113/117) Installing fontconfig-dev (2.13.1-r3)
(114/117) Installing libxrender-dev (0.9.10-r3)
(115/117) Installing libxft-dev (2.3.3-r0)
(116/117) Installing tk (8.6.10-r1)
(117/117) Installing tk-dev (8.6.10-r1)
Executing busybox-1.32.1-r6.trigger
Executing glib-2.66.8-r0.trigger
No schema files found: doing nothing.
OK: 578 MiB in 160 packages
Removing intermediate container d70e0b1afa34
 ---> bda6f725d14c
Step 7/10 : USER gunicorn
 ---> Running in 98f2643c779a
Removing intermediate container 98f2643c779a
 ---> ce35cb1e109c
Step 8/10 : WORKDIR /usr/django/app/lasa
 ---> Running in 66978d1625e2
Removing intermediate container 66978d1625e2
 ---> d0b8ae7b5f09
Step 9/10 : RUN pip install pillow psycopg2
 ---> Running in d8903cb53e96
Defaulting to user installation because normal site-packages is not writeable
Collecting pillow
  Downloading Pillow-8.3.1.tar.gz (48.7 MB)
Collecting psycopg2
  Downloading psycopg2-2.9.1.tar.gz (379 kB)
Building wheels for collected packages: pillow, psycopg2
  Building wheel for pillow (setup.py): started
  Building wheel for pillow (setup.py): finished with status 'done'
  Created wheel for pillow: filename=Pillow-8.3.1-cp39-cp39-linux_x86_64.whl size=597179 sha256=f01adb977feaf36cd50d134e2f367475fe49c4854f4693ae086ed409a45bd372
  Stored in directory: /home/gunicorn/.cache/pip/wheels/1c/ad/3d/cd4a93b06238ec906453ef182563d30767534ae65bd5d91923
  Building wheel for psycopg2 (setup.py): started
  Building wheel for psycopg2 (setup.py): finished with status 'done'
  Created wheel for psycopg2: filename=psycopg2-2.9.1-cp39-cp39-linux_x86_64.whl size=156335 sha256=d0e54a26d0547769e01a1d5e44c03986d0a931a2a4c0acfd66cea1428a5ef687
  Stored in directory: /home/gunicorn/.cache/pip/wheels/45/d6/2e/e3754ab051b88bc61600becca31679204854009c4a2adbc586
Successfully built pillow psycopg2
Installing collected packages: psycopg2, pillow
Successfully installed pillow-8.3.1 psycopg2-2.9.1
Removing intermediate container d8903cb53e96
 ---> d81d1c5c87ad
Step 10/10 : RUN mv lasa/settings.prod.py lasa/settings.py
 ---> Running in df55269b3696
Removing intermediate container df55269b3696
 ---> 1a5ab0b55804
Successfully built 1a5ab0b55804
Successfully tagged foo/lasa:latest

Launch command:

docker run -dp 8000:8000 -v lasa-static --name lasa_backend foo/lasa

I don't think I'm doing anything so silly as overwriting the start.sh your build file puts in /usr/django, so I'm sorta at a loss for what's going so very wrong. I assume this is a "me" issue.

ModuleNotFoundError: No module named '.wsgi'

Hi, I'm new with Docker and Django,
I builded your image but I have this error

ModuleNotFoundError: No module named '.wsgi'

It's probably from gunicorn but I don't know how it works.

I'm using docker for windows (shame on me)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.