ImportError: no module with crispy shapes

I am working on some django applications, but anyway. I would like to use crispy forms, but eclipse and django will not recognize it.

Attempt to start a server or shell:

$ python manage.py runserver

it happens:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 87, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named crispy-forms

This is form.py, which I recently added to the site folder along with view.py, and it complains about unauthorized import of crispy_forms ...:

from django.contrib.auth.forms import UserCreationForm
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, ButtonHolder, Submit
from wx.lib.pubsub.core import kwargs

class RegistrationForm(UserCreationForm):
    def __init__(self, *args, **kwargs):
        super(RegistrationForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.layout = Layout(
            'username',
            'password1',
            'password2',
            ButtonHolder(
                Submit('register', 
                       'Register', 
                       css_class='btn-prima'
                )
            )
        )

This is my part of my .py settings:

    INSTALLED_APPS = (
        'django.contrib.admin',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.messages',
        'django.contrib.staticfiles',
        'polls',
        'crispy-forms',
    )

...
CRISPY_TEMPLATE_PACK = 'bootstrap'

I run virtualenv, my venv-dir looks like this:

venv/bin$ ls -la
total 2916
drwxr-xr-x 3 nr1 nr1    4096 Feb 17 11:24 .
drwxr-xr-x 6 nr1 nr1    4096 Feb 16 19:38 ..
-rw-r--r-- 1 nr1 nr1    2220 Feb 16 19:35 activate
-rw-r--r-- 1 nr1 nr1    1276 Feb 16 19:35 activate.csh
-rw-r--r-- 1 nr1 nr1    2489 Feb 16 19:35 activate.fish
-rw-r--r-- 1 nr1 nr1    1137 Feb 16 19:35 activate_this.py
-rwxr-xr-x 1 nr1 nr1     300 Feb 16 19:44 django-admin
-rwxr-xr-x 1 nr1 nr1     159 Feb 16 19:44 django-admin.py
-rw-r--r-- 1 nr1 nr1     304 Feb 16 19:44 django-admin.pyc
-rwxr-xr-x 1 nr1 nr1     267 Feb 17 11:24 easy_install
-rwxr-xr-x 1 nr1 nr1     267 Feb 17 11:24 easy_install-2.7
drwxr-xr-x 7 nr1 nr1    4096 Feb 16 19:47 .git
-rwxr-xr-x 1 nr1 nr1    2364 Feb 17 00:13 pilconvert.py
-rwxr-xr-x 1 nr1 nr1   15631 Feb 17 00:13 pildriver.py
-rwxr-xr-x 1 nr1 nr1    2609 Feb 17 00:13 pilfile.py
-rwxr-xr-x 1 nr1 nr1    1055 Feb 17 00:13 pilfont.py
-rwxr-xr-x 1 nr1 nr1    2410 Feb 17 00:13 pilprint.py
-rwxr-xr-x 1 nr1 nr1     239 Feb 17 11:24 pip
-rwxr-xr-x 1 nr1 nr1     239 Feb 17 11:24 pip2
-rwxr-xr-x 1 nr1 nr1     239 Feb 17 11:24 pip2.7
-rwxr-xr-x 1 nr1 nr1 2884984 Feb 17 11:24 python
lrwxrwxrwx 1 nr1 nr1       6 Feb 17 11:24 python2 -> python
lrwxrwxrwx 1 nr1 nr1       6 Feb 17 11:24 python2.7 -> python
-rwxr-xr-x 1 nr1 nr1    3886 Feb 17 00:11 sqlformat

I accidentally managed to type: pip install python today, and it seems like it was. Could this affect this? I mean, isn't this a virtual task to make sure there are no software conflicts?

Anyway, I can't start Django-work now, until I find out, is there any help there?

Update 1 change:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'polls',
    'crispy_forms',
)

$ python manage.py runserver

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 87, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named crispy_forms


$ cat requirements.txt 
Django==1.7.4
django-crispy-forms==1.4.0
django-debug-toolbar==1.2.2
django-extras==0.3
django-grappelli==2.6.3
django-haystack==2.3.1
django-reversion==1.8.5
django-tastypie==0.12.1
easy-thumbnails==2.2
Pillow==2.7.0
python-dateutil==2.4.0
python-mimeparse==0.1.4
requests==2.5.1
six==1.9.0
sqlparse==0.1.14

2: django-, virtualenv, ..

(abc) nr1 @kali: ~/workspace/websites/abc $pip install django-crispy-forms - django-crispy-forms-1.4.0.tar.gz : django-crispy-forms setup.py django-crispy-forms django-crispy-forms-1.4.0

(abc)nr1@kali:~/workspace/websites/abc$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/nr1/Envs/abc/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/nr1/Envs/abc/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/home/nr1/Envs/abc/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/nr1/Envs/abc/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/nr1/Envs/abc/local/lib/python2.7/site-packages/django/apps/config.py", line 123, in create
    import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named crispy_forms

crispy_forms , virtualenv, :

nr1@kali:~/Envs/abc/local/lib/python2.7/site-packages$ ls -la
total 56
drwxr-xr-x 12 nr1 nr1 4096 Feb 17 21:50 .
drwxr-xr-x  4 nr1 nr1 4096 Feb 17 20:31 ..
drwxr-xr-x  5 nr1 nr1 4096 Feb 17 21:50 crispy_forms
drwxr-xr-x 17 nr1 nr1 4096 Feb 17 20:40 django
drwxr-xr-x  2 nr1 nr1 4096 Feb 17 20:40 Django-1.7.4.dist-info
drwxr-xr-x  2 nr1 nr1 4096 Feb 17 21:50 django_crispy_forms-1.4.0-py2.7.egg-info
-rw-r--r--  1 nr1 nr1  126 Feb 17 20:31 easy_install.py
-rw-r--r--  1 nr1 nr1  315 Feb 17 20:31 easy_install.pyc
drwxr-xr-x  2 nr1 nr1 4096 Feb 17 20:31 _markerlib
drwxr-xr-x 10 nr1 nr1 4096 Feb 17 20:31 pip
drwxr-xr-x  2 nr1 nr1 4096 Feb 17 20:31 pip-6.0.8.dist-info
drwxr-xr-x  4 nr1 nr1 4096 Feb 17 20:31 pkg_resources
drwxr-xr-x  4 nr1 nr1 4096 Feb 17 20:31 setuptools
drwxr-xr-x  2 nr1 nr1 4096 Feb 17 20:31 setuptools-12.0.5.dist-info

, . Django , . ?? virtualenv , django can not ??? WTX...

+4
7

, () : Django:

, - pythonpath.

easy_install, :

 $ easy_install -Z django-crispy-forms
    Searching for django-crispy-forms
    Best match: django-crispy-forms 1.4.0
    Adding django-crispy-forms 1.4.0 to easy-install.pth file

    Using /home/nr1/Envs/abc/lib/python2.7/site-packages
    Processing dependencies for django-crispy-forms
    Finished processing dependencies for django-crispy-forms

! , - pythonpath, eclipse:

SignUpView Found at: __module_not_in_the_pythonpath__

, - , ...

django crispy_forms . YippikayeyMF!!

+2

, , python 2.7, Django-1.10 python 3.5, , .

: pip3 install --user django-crispy-forms

+7

, virtualenv.

  • VirtualEnv ( env - / ):

    env/bin/activate

  • pip install django-crispy-forms

+1

PyCharm Django. ​​ , , PyCharm, Python, PyCharm . Python, virtalenv, IDE (PyCharm), . , Pythonpath - ...

Eclipse ? , .

!

0

.

  • Virtualenv.
  • .
  • Virtualenv , .

, django , , env.
, - .

0

. - , " " . : - IDE, python, , python .

  • Do not assume that your "virtualenv" points to the correct directory, as your "External Libraries" are stored. So if you go ahead and install in the wrong directory, then such an error will be normal
0
source

All Articles