2
votes

I am migrating a Django project to production and was going through python manage.py collectstatic phase.

After running this command, I get an error:

ImportError: No module named djangocms_admin_style

However, I clearly have this module installed as both pip list and a manual inspection of the directories shows.

What's more, preceeding this error, there is the following traceback:

File "manage.py", line 10, in

execute_from_command_line(sys.argv)   File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py",

line 354, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/site-packages/django/core/management/init.py",

line 328, in execute django.setup() File "/usr/local/lib/python2.7/site-packages/django/init.py", line 18,

in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate

app_config = AppConfig.create(entry)   File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line

86, in create

module = import_module(entry)   File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in

import_module import(name)

What confuses me about the traceback is that there are multiple references to the system-wide Python instead of the one I created within the virtualenv. Why is that? I suspect that this has something to do with the error above.

If it helps, I do not have anything custom (including django_admin_styles) installed in the system Python environment, only within my virtualenv, which is also activated when the commands are run.

Any help is appreciated.

1

1 Answers

0
votes

Are you using VSCode by any chance? Along with setting up the environment, you need to reference the correct python executable by setting the "python.pythonPath" setting to the path of the python executable inside your virtual environment.