django-crispy-forms / crispy-test-project

Simple Django project for testing https://github.com/maraujop/django-crispy-forms based on https://gist.github.com/maraujop/1838193
https://crispy-test-project.herokuapp.com
9 stars 12 forks source link

pipenv install uses wrong django version #11

Closed smithdc1 closed 5 years ago

smithdc1 commented 5 years ago

I ran 'pipenv install' to create virtual environment and install packages from the pipfile and pipfile.lock

Running then 'pip list' gives

Package                  Version
------------------------ -------
crispy-forms-semantic-ui 0.2.0
Django                   2.2.5
django-crispy-forms      1.7.2
gunicorn                 19.9.0
pip                      19.2.3
pytz                     2019.2
setuptools               41.2.0
sqlparse                 0.3.0
wheel                    0.33.6

However, when django server is started the following error message is produced.

Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\David_2\.pyenv\pyenv-win\versions\3.6.2\Lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Users\David_2\.pyenv\pyenv-win\versions\3.6.2\Lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\David_2\.virtualenvs\crispy-test-project-LRAMdbIO\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper       
    fn(*args, **kwargs)
  File "C:\Users\David_2\.virtualenvs\crispy-test-project-LRAMdbIO\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\David_2\.virtualenvs\crispy-test-project-LRAMdbIO\lib\site-packages\django\core\management\base.py", line 436, in check    
    raise SystemCheckError(msg)
django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS:
?: (admin.E408) 'django.contrib.auth.middleware.AuthenticationMiddleware' must be in MIDDLEWARE in order to use the admin application.      
?: (admin.E409) 'django.contrib.messages.middleware.MessageMiddleware' must be in MIDDLEWARE in order to use the admin application.
?: (admin.E410) 'django.contrib.sessions.middleware.SessionMiddleware' must be in MIDDLEWARE in order to use the admin application.

System check identified 3 issues (0 silenced).

However if requirements are installed from requirements.txt then 'pip list' gives the following (and the django server runs fine).

Package                  Version
------------------------ -------
crispy-forms-semantic-ui 0.2.0
Django                   2.1.11
django-crispy-forms      1.7.2
gunicorn                 19.9.0
pip                      19.2.3
pytz                     2018.5
setuptools               41.2.0
sqlparse                 0.3.0
wheel                    0.33.6
smithdc1 commented 5 years ago

Just realised that there is already a pull request which probably fixes this

Ensuring compatibility with django 2.2

carltongibson commented 5 years ago

Ok, I merged the PR. Thanks!

smithdc1 commented 5 years ago

I learnt a lesson here! I should have done some more detailed checking of the PR before pointing it out. Since the merge of the PR the project doesn't work at all, it's broken on both django 2.1 and 2.2.

I'll try and look into it in more detail over the next few days.

carltongibson commented 5 years ago

It's not entirely clear why... New style MIDDLEWARE was introduced in Django 1.10