DS9
DS9

Reputation: 3033

Deploying old Django project to new host

I have Django 1.6 project and is run using the Gunicorn web application server behind the Nginx web server. Now I want to transfer that project to new host. For that I have copied all code across the new machine and install all required dependencies using pip install -r requirements.txt that went successful.

But after that if I am trying to do either of below python manage.py migrate or python manage.py runserver 0.0.0.0:8000 itt gives below error:

Unhandled exception in thread started by <function wrapper at 0x7f9a114e1938>
Traceback (most recent call last):
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
    fn(*args, **kwargs)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 102, in inner_run
    self.validate(display_num_errors=True)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
    num_errors = get_validation_errors(s, app)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
    self._populate()
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/db/models/loading.py", line 75, in _populate
    self.load_app(app_name, True)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
    models = import_module('%s.models' % app_name)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/filer/models/__init__.py", line 2, in <module>
    from filer.models.clipboardmodels import *
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/filer/models/clipboardmodels.py", line 7, in <module>
    from filer.models import filemodels
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/filer/models/filemodels.py", line 13, in <module>
    from polymorphic import PolymorphicModel, PolymorphicManager
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/polymorphic/__init__.py", line 13, in <module>
    _version_ = pkg_resources.require("django-polymorphic")[0].version
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 984, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 875, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Django 1.6.8 (/var/www/html/forttottensquare/env/lib/python2.7/site-packages), Requirement.parse('Django>=1.11'), set(['django-polymorphic']))
https://simpleisbetterthancomplex.com/tutorial/2016/10/14/how-to-deploy-to-digital-ocean.html

So how to solve it?

Update

After doing pip install django-polymorphic==1.3 its gives below error:

Unhandled exception in thread started by <function wrapper at 0x7f0dc09bd938>
Traceback (most recent call last):
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
    fn(*args, **kwargs)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 102, in inner_run
    self.validate(display_num_errors=True)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
    num_errors = get_validation_errors(s, app)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
    self._populate()
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
    self.load_app(app_name)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
    models = import_module('%s.models' % app_name)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/filer/models/__init__.py", line 2, in <module>
    from filer.models.clipboardmodels import *
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/filer/models/clipboardmodels.py", line 7, in <module>
    from filer.models import filemodels
  File "/var/www/html/forttottensquare/env/local/lib/python2.7/site-packages/filer/models/filemodels.py", line 13, in <module>
    from polymorphic import PolymorphicModel, PolymorphicManager
ImportError: cannot import name PolymorphicModel

Upvotes: 0

Views: 614

Answers (1)

itzMEonTV
itzMEonTV

Reputation: 20339

Do (downgrade)

pip install django-polymorphic==1.3

If not working, do bit more older version.

Upvotes: 4

Related Questions