1

Dockerを使用したPyDannyによるcookiecutter-djangoを使用してDjangoプロジェクトを作成しました。
これは virtualenvwrapper 内にあり、docker-compose を使用しています。

いいえ、パッケージをインストールしようとしています (django-admin-bootstrapped)。

django-admin-bootstrapped を 2 か所に追加しました。

project_root/config/settings/common.py

DJANGO_APPS = (
    # Default Django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # Admin
    'django-admin-bootstrapped',
    'django.contrib.admin',
)

project_root/requirements/base.txt

# Your custom requirements go here
django-admin-bootstrapped==2.5.7

この後、サーバーを (Pycharm 内で) 停止して実行しますdocker-compose -f dev.yml build

メッセージには次のように表示されます。

Running setup.py install for django-admin-bootstrapped: started
Running setup.py install for django-admin-bootstrapped: finished with status 'done'

トレース全体:

Building postgres
Step 1 : FROM postgres:9.5
 ---> 7ee9d2061970
Step 2 : ADD backup.sh /usr/local/bin/backup
 ---> Using cache
 ---> 4172481b25a5
Step 3 : ADD restore.sh /usr/local/bin/restore
 ---> Using cache
 ---> 67677d6f568a
Step 4 : ADD list-backups.sh /usr/local/bin/list-backups
 ---> Using cache
 ---> 960d5e4aa8e3
Step 5 : RUN chmod +x /usr/local/bin/restore
 ---> Using cache
 ---> a2ebe8145fbf
Step 6 : RUN chmod +x /usr/local/bin/list-backups
 ---> Using cache
 ---> 0827ac792a0b
Step 7 : RUN chmod +x /usr/local/bin/backup
 ---> Using cache
 ---> 0a678483ed72
Successfully built 0a678483ed72
Building django
Step 1 : FROM python:3.5
 ---> 7fd24fb1b492
Step 2 : ENV PYTHONUNBUFFERED 1
 ---> Using cache
 ---> 78e28bdf617f
Step 3 : COPY ./requirements /requirements
 ---> Using cache
 ---> 27e5784b3d1b
Step 4 : RUN pip install -r /requirements/local.txt
 ---> Running in 75445ffa29e0
Collecting wheel==0.29.0 (from -r /requirements/base.txt (line 5))
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
Collecting django==1.9.7 (from -r /requirements/base.txt (line 9))
  Downloading Django-1.9.7-py2.py3-none-any.whl (6.6MB)
Collecting django-environ==0.4.0 (from -r /requirements/base.txt (line 13))
  Downloading django-environ-0.4.0.tar.gz
Collecting django-braces==1.9.0 (from -r /requirements/base.txt (line 17))
  Downloading django_braces-1.9.0-py2.py3-none-any.whl
Collecting django-crispy-forms==1.6.0 (from -r /requirements/base.txt (line 18))
  Downloading django-crispy-forms-1.6.0.tar.gz (118kB)
Collecting django-floppyforms==1.6.2 (from -r /requirements/base.txt (line 19))
  Downloading django-floppyforms-1.6.2.tar.gz (2.4MB)
Collecting django-model-utils==2.5 (from -r /requirements/base.txt (line 23))
  Downloading django-model-utils-2.5.tar.gz
Collecting Pillow==3.3.0 (from -r /requirements/base.txt (line 27))
  Downloading Pillow-3.3.0-cp35-cp35m-manylinux1_x86_64.whl (5.5MB)
Collecting django-allauth==0.25.2 (from -r /requirements/base.txt (line 32))
  Downloading django-allauth-0.25.2.tar.gz (408kB)
Collecting psycopg2==2.6.2 (from -r /requirements/base.txt (line 36))
  Downloading psycopg2-2.6.2.tar.gz (376kB)
Collecting unicode-slugify==0.1.3 (from -r /requirements/base.txt (line 40))
  Downloading unicode-slugify-0.1.3.tar.gz
Collecting django-autoslug==1.9.3 (from -r /requirements/base.txt (line 41))
  Downloading django_autoslug-1.9.3-py2.py3-none-any.whl
Collecting pytz==2016.4 (from -r /requirements/base.txt (line 45))
  Downloading pytz-2016.4-py2.py3-none-any.whl (480kB)
Collecting django-redis==4.4.3 (from -r /requirements/base.txt (line 49))
  Downloading django-redis-4.4.3.tar.gz (53kB)
Collecting redis>=2.10.0 (from -r /requirements/base.txt (line 50))
  Downloading redis-2.10.5-py2.py3-none-any.whl (60kB)
Collecting django-admin-bootstrapped==2.5.7 (from -r /requirements/base.txt (line 53))
  Downloading django-admin-bootstrapped-2.5.7.tar.gz (378kB)
Collecting coverage==4.1 (from -r /requirements/local.txt (line 4))
  Downloading coverage-4.1.tar.gz (370kB)
Collecting django-coverage-plugin==1.3.1 (from -r /requirements/local.txt (line 5))
  Downloading django_coverage_plugin-1.3.1.tar.gz
Collecting Sphinx==1.4.4 (from -r /requirements/local.txt (line 6))
  Downloading Sphinx-1.4.4-py2.py3-none-any.whl (1.6MB)
Collecting django-extensions==1.6.7 (from -r /requirements/local.txt (line 7))
  Downloading django_extensions-1.6.7-py2.py3-none-any.whl (206kB)
Collecting Werkzeug==0.11.10 (from -r /requirements/local.txt (line 8))
  Downloading Werkzeug-0.11.10-py2.py3-none-any.whl (306kB)
Collecting django-test-plus==1.0.14 (from -r /requirements/local.txt (line 9))
  Downloading django-test-plus-1.0.14.tar.gz
Collecting factory_boy==2.7.0 (from -r /requirements/local.txt (line 10))
  Downloading factory_boy-2.7.0-py2.py3-none-any.whl
Collecting django-debug-toolbar==1.4 (from -r /requirements/local.txt (line 11))
  Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB)
Collecting ipdb==0.10.1 (from -r /requirements/local.txt (line 15))
  Downloading ipdb-0.10.1.tar.gz
Collecting pytest-django==2.9.1 (from -r /requirements/local.txt (line 17))
  Downloading pytest_django-2.9.1-py2.py3-none-any.whl
Collecting pytest-sugar==0.7.1 (from -r /requirements/local.txt (line 18))
  Downloading pytest-sugar-0.7.1.tar.gz
Collecting six (from django-environ==0.4.0->-r /requirements/base.txt (line 13))
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting python3-openid>=3.0.8 (from django-allauth==0.25.2->-r /requirements/base.txt (line 32))
  Downloading python3-openid-3.0.10.zip (365kB)
Collecting requests-oauthlib>=0.3.0 (from django-allauth==0.25.2->-r /requirements/base.txt (line 32))
  Downloading requests_oauthlib-0.6.1-py2.py3-none-any.whl
Collecting requests>=1.0.3 (from django-allauth==0.25.2->-r /requirements/base.txt (line 32))
  Downloading requests-2.10.0-py2.py3-none-any.whl (506kB)
Collecting unidecode (from unicode-slugify==0.1.3->-r /requirements/base.txt (line 40))
  Downloading Unidecode-0.04.19.tar.gz (204kB)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python3.5/site-packages (from django-admin-bootstrapped==2.5.7->-r /requirements/base.txt (line 53))
Collecting imagesize (from Sphinx==1.4.4->-r /requirements/local.txt (line 6))
  Downloading imagesize-0.7.1-py2.py3-none-any.whl
Collecting alabaster<0.8,>=0.7 (from Sphinx==1.4.4->-r /requirements/local.txt (line 6))
  Downloading alabaster-0.7.8-py2.py3-none-any.whl
Collecting docutils>=0.11 (from Sphinx==1.4.4->-r /requirements/local.txt (line 6))
  Downloading docutils-0.12-py3-none-any.whl (508kB)
Collecting Pygments>=2.0 (from Sphinx==1.4.4->-r /requirements/local.txt (line 6))
  Downloading Pygments-2.1.3-py2.py3-none-any.whl (755kB)
Collecting babel!=2.0,>=1.3 (from Sphinx==1.4.4->-r /requirements/local.txt (line 6))
  Downloading Babel-2.3.4-py2.py3-none-any.whl (7.1MB)
Collecting snowballstemmer>=1.1 (from Sphinx==1.4.4->-r /requirements/local.txt (line 6))
  Downloading snowballstemmer-1.2.1-py2.py3-none-any.whl (64kB)
Collecting Jinja2>=2.3 (from Sphinx==1.4.4->-r /requirements/local.txt (line 6))
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
Collecting fake-factory>=0.5.0 (from factory_boy==2.7.0->-r /requirements/local.txt (line 10))
  Downloading fake_factory-0.5.9-py2.py3-none-any.whl (527kB)
Collecting sqlparse (from django-debug-toolbar==1.4->-r /requirements/local.txt (line 11))
  Downloading sqlparse-0.1.19.tar.gz (58kB)
Collecting ipython>=0.10.2 (from ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading ipython-5.0.0-py2.py3-none-any.whl (743kB)
Collecting pytest>=2.5 (from pytest-django==2.9.1->-r /requirements/local.txt (line 17))
  Downloading pytest-2.9.2-py2.py3-none-any.whl (162kB)
Collecting termcolor>=1.1.0 (from pytest-sugar==0.7.1->-r /requirements/local.txt (line 18))
  Downloading termcolor-1.1.0.tar.gz
Collecting defusedxml (from python3-openid>=3.0.8->django-allauth==0.25.2->-r /requirements/base.txt (line 32))
  Downloading defusedxml-0.4.1.tar.gz (48kB)
Collecting oauthlib>=0.6.2 (from requests-oauthlib>=0.3.0->django-allauth==0.25.2->-r /requirements/base.txt (line 32))
  Downloading oauthlib-1.1.2.tar.gz (111kB)
Collecting MarkupSafe (from Jinja2>=2.3->Sphinx==1.4.4->-r /requirements/local.txt (line 6))
  Downloading MarkupSafe-0.23.tar.gz
Collecting python-dateutil>=2.4 (from fake-factory>=0.5.0->factory_boy==2.7.0->-r /requirements/local.txt (line 10))
  Downloading python_dateutil-2.5.3-py2.py3-none-any.whl (201kB)
Collecting decorator (from ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading decorator-4.0.10-py2.py3-none-any.whl
Collecting traitlets>=4.2 (from ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading traitlets-4.2.2-py2.py3-none-any.whl (68kB)
Collecting pexpect; sys_platform != "win32" (from ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading pexpect-4.2.0-py2.py3-none-any.whl (56kB)
Collecting simplegeneric>0.8 (from ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading simplegeneric-0.8.1.zip
Collecting prompt-toolkit<2.0.0,>=1.0.3 (from ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading prompt_toolkit-1.0.3-py3-none-any.whl (249kB)
Collecting pickleshare (from ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading pickleshare-0.7.2-py2.py3-none-any.whl
Collecting py>=1.4.29 (from pytest>=2.5->pytest-django==2.9.1->-r /requirements/local.txt (line 17))
  Downloading py-1.4.31-py2.py3-none-any.whl (81kB)
Collecting ipython-genutils (from traitlets>=4.2->ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading ipython_genutils-0.1.0-py2.py3-none-any.whl
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading ptyprocess-0.5.1-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.3->ipython>=0.10.2->ipdb==0.10.1->-r /requirements/local.txt (line 15))
  Downloading wcwidth-0.1.7-py2.py3-none-any.whl
Installing collected packages: wheel, django, six, django-environ, django-braces, django-crispy-forms, django-floppyforms, django-model-utils, Pillow, defusedxml, python3-openid, oauthlib, requests, requests-oauthlib, django-allauth, psycopg2, unidecode, unicode-slugify, django-autoslug, pytz, redis, django-redis, django-admin-bootstrapped, coverage, django-coverage-plugin, imagesize, alabaster, docutils, Pygments, babel, snowballstemmer, MarkupSafe, Jinja2, Sphinx, django-extensions, Werkzeug, django-test-plus, python-dateutil, fake-factory, factory-boy, sqlparse, django-debug-toolbar, decorator, ipython-genutils, traitlets, ptyprocess, pexpect, simplegeneric, wcwidth, prompt-toolkit, pickleshare, ipython, ipdb, py, pytest, pytest-django, termcolor, pytest-sugar
  Running setup.py install for django-environ: started
    Running setup.py install for django-environ: finished with status 'done'
  Running setup.py install for django-crispy-forms: started
    Running setup.py install for django-crispy-forms: finished with status 'done'
  Running setup.py install for django-floppyforms: started
    Running setup.py install for django-floppyforms: finished with status 'done'
  Running setup.py install for django-model-utils: started
    Running setup.py install for django-model-utils: finished with status 'done'
  Running setup.py install for defusedxml: started
    Running setup.py install for defusedxml: finished with status 'done'
  Running setup.py install for python3-openid: started
    Running setup.py install for python3-openid: finished with status 'done'
  Running setup.py install for oauthlib: started
    Running setup.py install for oauthlib: finished with status 'done'
  Running setup.py install for django-allauth: started
    Running setup.py install for django-allauth: finished with status 'done'
  Running setup.py install for psycopg2: started
    Running setup.py install for psycopg2: finished with status 'done'
  Running setup.py install for unidecode: started
    Running setup.py install for unidecode: finished with status 'done'
  Running setup.py install for unicode-slugify: started
    Running setup.py install for unicode-slugify: finished with status 'done'
  Running setup.py install for django-redis: started
    Running setup.py install for django-redis: finished with status 'done'
  Running setup.py install for django-admin-bootstrapped: started
    Running setup.py install for django-admin-bootstrapped: finished with status 'done'
  Running setup.py install for coverage: started
    Running setup.py install for coverage: finished with status 'done'
  Running setup.py install for django-coverage-plugin: started
    Running setup.py install for django-coverage-plugin: finished with status 'done'
  Running setup.py install for MarkupSafe: started
    Running setup.py install for MarkupSafe: finished with status 'done'
  Running setup.py install for django-test-plus: started
    Running setup.py install for django-test-plus: finished with status 'done'
  Running setup.py install for sqlparse: started
    Running setup.py install for sqlparse: finished with status 'done'
  Running setup.py install for simplegeneric: started
    Running setup.py install for simplegeneric: finished with status 'done'
  Running setup.py install for ipdb: started
    Running setup.py install for ipdb: finished with status 'done'
  Running setup.py install for termcolor: started
    Running setup.py install for termcolor: finished with status 'done'
  Running setup.py install for pytest-sugar: started
    Running setup.py install for pytest-sugar: finished with status 'done'
Successfully installed Jinja2-2.8 MarkupSafe-0.23 Pillow-3.3.0 Pygments-2.1.3 Sphinx-1.4.4 Werkzeug-0.11.10 alabaster-0.7.8 babel-2.3.4 coverage-4.1 decorator-4.0.10 defusedxml-0.4.1 django-1.9.7 django-admin-bootstrapped-2.5.7 django-allauth-0.25.2 django-autoslug-1.9.3 django-braces-1.9.0 django-coverage-plugin-1.3.1 django-crispy-forms-1.6.0 django-debug-toolbar-1.4 django-environ-0.4.0 django-extensions-1.6.7 django-floppyforms-1.6.2 django-model-utils-2.5 django-redis-4.4.3 django-test-plus-1.0.14 docutils-0.12 factory-boy-2.7.0 fake-factory-0.5.9 imagesize-0.7.1 ipdb-0.10.1 ipython-5.0.0 ipython-genutils-0.1.0 oauthlib-1.1.2 pexpect-4.2.0 pickleshare-0.7.2 prompt-toolkit-1.0.3 psycopg2-2.6.2 ptyprocess-0.5.1 py-1.4.31 pytest-2.9.2 pytest-django-2.9.1 pytest-sugar-0.7.1 python-dateutil-2.5.3 python3-openid-3.0.10 pytz-2016.4 redis-2.10.5 requests-2.10.0 requests-oauthlib-0.6.1 simplegeneric-0.8.1 six-1.10.0 snowballstemmer-1.2.1 sqlparse-0.1.19 termcolor-1.1.0 traitlets-4.2.2 unicode-slugify-0.1.3 unidecode-0.4.19 wcwidth-0.1.7 wheel-0.29.0
 ---> 619785f9cafb
Removing intermediate container 75445ffa29e0
Step 5 : COPY ./compose/django/entrypoint.sh /entrypoint.sh
 ---> c3bf84c88ee8
Removing intermediate container 87963ff6b60c
Step 6 : RUN sed -i 's/\r//' /entrypoint.sh
 ---> Running in 12a018d70328
 ---> 7b60c66deff7
Removing intermediate container 12a018d70328
Step 7 : RUN chmod +x /entrypoint.sh
 ---> Running in 6b57f153cde3
 ---> a82ca37f275c
Removing intermediate container 6b57f153cde3
Step 8 : WORKDIR /app
 ---> Running in 036ba3f70df1
 ---> 0078329f0874
Removing intermediate container 036ba3f70df1
Step 9 : ENTRYPOINT /entrypoint.sh
 ---> Running in 99b17af9031d
 ---> 3d7a999f3436
Removing intermediate container 99b17af9031d
Successfully built 3d7a999f3436
Building pycharm
Step 1 : FROM python:3.5
 ---> 7fd24fb1b492
Step 2 : ENV PYTHONUNBUFFERED 1
 ---> Using cache
 ---> 78e28bdf617f
Step 3 : COPY ./requirements /requirements
 ---> Using cache
 ---> 27e5784b3d1b
Step 4 : RUN pip install -r /requirements/local.txt
 ---> Using cache
 ---> 619785f9cafb
Step 5 : COPY ./compose/django/entrypoint.sh /entrypoint.sh
 ---> Using cache
 ---> c3bf84c88ee8
Step 6 : RUN sed -i 's/\r//' /entrypoint.sh
 ---> Using cache
 ---> 7b60c66deff7
Step 7 : RUN chmod +x /entrypoint.sh
 ---> Using cache
 ---> a82ca37f275c
Step 8 : WORKDIR /app
 ---> Using cache
 ---> 0078329f0874
Step 9 : ENTRYPOINT /entrypoint.sh
 ---> Using cache
 ---> 3d7a999f3436
Successfully built 3d7a999f3436

Pycharm設定のProject / Project Interpreterには、DjangoとPycharmの2つのリモートインタープリターがあります(インストール手順に従って)。
どちらもパッケージに django-admin-bootstrapped が含まれています。

サーバーを再起動すると、エラーが発生します

ImportError: No module named 'django-admin-bootstrapped'

念のため、virtualenvwrapper 内とグローバル python サイト パッケージの両方にブートストラップされた django-admin をインストールしました。

これを起動して実行するには、ここで何ができますか?

前もって感謝します

4

1 に答える 1

2

そして突然、それは私を襲った:

Djangoの設定では、django_admin_bootstrapped代わりに配置する必要がありましたdjango-admin-bootstrapped

変更したら、それは魅力のように機能しました。

于 2016-07-10T19:33:13.717 に答える