How to allow cannot import name pages (django / wagtail)

I recently tried to get wagtail to work with my existing Django application. I got an error: -

ImportError: No module named wagtail
unable to load app 0 (mountpoint='') (callable not found or import error)

After significant troubleshooting, I managed to fix it by copying the wagtail folder from:

/usr/local/lib/python2.7/dist-packages/

here

/opt/django/src/

By eliminating this error, I received different information about another module, and another ... every time I copied the folder from /usr/local/lib/python2.7/dist-packages/to /opt/django/src/, and as a result, it resolved the problems that I had and the uWSGI started working.

Now, when I access the home page of my application, I get this error

ImportError at /

cannot import name pages

    Request Method:     GET
Request URL:    http://example.com
Django Version:     1.9
Exception Type:     ImportError
Exception Value:    

cannot import name pages

Exception Location:     ./wagtail/wagtailadmin/urls/__init__.py in <module>, line 4
Python Executable:  /usr/local/bin/uwsgi
Python Version:     2.7.3
Python Path:    

['.',
 '',
 '/opt/django/src',
 '/root/.python',
 '/opt/django/env/lib/python2.7',
 '/opt/django/env/lib/python2.7/plat-linux2',
 '/opt/django/env/lib/python2.7/lib-tk',
 '/opt/django/env/lib/python2.7/lib-old',
 '/opt/django/env/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/opt/django/env/local/lib/python2.7/site-packages',
 '/opt/django/env/lib/python2.7/site-packages']

I checked the file referenced by ( ./wagtail/wagtailadmin/urls/__init__.py) and it looks like this:

from django.conf.urls import url, include
from django.views.decorators.cache import cache_control

from wagtail.wagtailadmin.urls import pages as wagtailadmin_pages_urls
from wagtail.wagtailadmin.urls import collections as wagtailadmin_collections_urls
from wagtail.wagtailadmin.urls import password_reset as wagtailadmin_password_reset_urls
from wagtail.wagtailadmin.views import account, chooser, home, pages, tags, userbar
from wagtail.wagtailadmin.api import urls as api_urls
from wagtail.wagtailcore import hooks
from wagtail.utils.urlpatterns import decorate_urlpatterns
from wagtail.wagtailadmin.decorators import require_admin_access

Offensive line - this is the first shake "of" ...

from wagtail.wagtailadmin.urls imports pages as wagtailadmin_pages_urls

?

+6
2

wagtail. Ubuntu 14 ( Cloud9 IDE).

1: 2.7

sudo pip install wagtail
ERRO: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

: x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/libImaging/codec_fd.o: No such file or directory. .

2 - Python 2.7 virtualenv

sudo pip install virtualenv
virtualenv env 
source env/bin/activate

github https://github.com/wagtail/wagtail

pip install wagtail 
out: Successfully installed Django-1.10.7 Pillow-4.1.1 Unidecode-0.4.20 Willow-0.4 beautifulsoup4-4.5.3 django-modelcluster-3.1 django-taggit-0.22.1 django-treebeard-4.1.0 djangorestframework-3.6.2 html5lib-0.999999999 olefile-0.44 pytz-2017.2 requests-2.13.0 wagtail-1.9.1 webencodings-0.5.1
wagtail start mysite
cd mysite
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

/dev.py ALLOWED_HOSTS = ['*'], 9. $IP: $PORT . !

Test3 - Python 3.4 virtualenv

sudo pip3 install virtualenv
virtualenv -p python3 env
source env/bin/activate
pip install wagtail
Successfully installed Django-1.10.7 Pillow-4.1.1 Unidecode-0.4.20 Willow-0.4 beautifulsoup4-4.5.3 django-modelcluster-3.1 django-taggit-0.22.1 django-treebeard-4.1.0 djangorestframework-3.6.2 html5lib-0.999999999 olefile-0.44 pytz-2017.2 requests-2.13.0 wagtail-1.9.1 webencodings-0.5.1

. !

4 - Python 3.4 virtualenv

sudo pip3 install wagtail
out: Successfully installed wagtail django-taggit requests Unidecode Django djangorestframework Pillow beautifulsoup4 Willow django-modelcluster django-treebeard olefile pytz
wagtail start mysite
python3 manage.py migrate
python3 manage.py createsuperuser
python3 manage.py runserver

EDIT: . python3, python . !

. , Ubuntu 14 python2. python3 virtualenv. , : , .

: , , :

wagtail Django

(Pillow, Django rest, beatifullsoup , ) , . , Django . -. ( python3 ;)). ( ). . , , . , wagtail , django ?

uWSGI.

, ? . virtualenv , . .

, ! !

+4

:

wagtail.wagtailadmin.urls wagtailadmin_pages_urls

wagtail Google App Engine dev-.

-, , GAE, PIL. BOTH, PIL , /lib. PIL app.yaml - , pip install -t lib/-r requirements-vendor.txt, PIL lib ( )

+1

Source: https://habr.com/ru/post/1016118/


All Articles