Upgrade python to 2.7 and Django to 1.4, but it tells me No module named *

I have just upgraded my python to 2.7 on my Ubuntu server, and reinstalled the Django to 1.4. I use python flup to run the Django application as fastcgi, but when I try to restart the application, it keeps telling me No module named *

e.g.

File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
...
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named *

The issue was initiated by manage.py file in the old Django (1.3) project, but according to the document https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py

that's how I run the project using python-flup

exec python ./manage.py runfcgi host=127.0.0.1 port=8083 maxchildren=40 pidfile=$PIDFILE --settings=expand.settings

The old-style manage.py will continue to work as before until Django 1.6. In 1.5 it will raise DeprecationWarning


Asked by: Patrick330 | Posted: 06-12-2021






Answer 1

I'm guesing by looking at django's source code that there's something wrong with either the layout of your project or your python path.

execute_from_command_line(sys.argv)

Runs the following snippet (from django/core/management/init.py), which is most likely the cause of your error:

# Import the project module. We add the parent directory to PYTHONPATH to
# avoid some of the path errors new users can have.
sys.path.append(os.path.join(project_directory, os.pardir))
import_module(project_name)
sys.path.pop()

Answered by: Kellan696 | Posted: 07-01-2022



Similar questions

python - Django Upgrade from 1.1.1 to 1.5 or any other

I am working on a project using Django-1.1.1 which has become obsolete and is no more available for consumption. As a result, we're pondering to upgrade it to django's later version so that we can build on it. Here are some of the questions before us: What version of Django do you recommend we upgrade to? What are the Python compatibilities? Are there any hardware enhancements do I need to d...


python - How to upgrade django?

My project was running on Django 1.5.4 and I wanted to upgrade it. I did pip install -U -I django and now pip freeze shows Django 1.6.5 (clearly django has upgraded, I'm in virtualenv) but my project is still using Django 1.5.4. How can I use the upgraded version? UPDATE: Thanks for your comments. I tried everything but unfortunately nothing worked and I had to re-deploy the ...


python - Upgrade from Django 1.6 to 1.7 on Ubuntu 12.04

I tried to upgrade django from version 1.6.5 to 1.7 through pip and easy_install but it does not work : $ pip2.7 install --upgrade django Requirement already up-to-date: django in /usr/local/lib/python2.7/dist-packages Cleaning up... Apart from installing django from the source, is there another way to force the upgrade ?


python - Django upgrade from 1.2.5 to 1.3 error in admin

I am attempting to upgrade a website running django 1.2.5 to 1.3 The only error I have encountered so far is in the admin part of the site: __init__() got an unexpected keyword argument 'field_path' which I think is from somewhere in this code: class EventAdmin(admin.ModelAdmin): inlines = [EventArtistsInline, EventGalleryInline, EventRelatedObjectInline, EventPriceInli...


python - Getting long error trying to upgrade Django

I'm trying to run pip install -U Django but I'm getting a super long error: Exception: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/c...


python - Unit tests fail after a Django upgrade

I am trying to bring a Django project from version 1.8 to 1.11. Pretty much everything seems to work fine except unit tests. We have a base test class inheriting from Django TestCase with a Tastypie mixin. The base class has some code in the setUp() like this class BaseApiTest(ResourceTestCaseMixin, django.test.TestCase): def setUp(self): super().setUp() self.username = "secret_user" ...


python - After upgrade to Django 1.11 site doesn't work in Chrome

I face strange problem. When running django development server I cant display pages in Chrome but I can in FireFox and MsEdge. The server returns 200 response, so page should be displayed. I did not touch any options related to security. Chrome stucks on spinning wheel, and no other information is available, no timeout, no errors. Django 1.11.7 here. Its not just my PC I tested on few others. Do not hasitat...


python - urls error in django 1.11.x upgrade to 2.0

I am migrating my project from django 1.11.x to 2.0. I have everything going well till I got to urls. I happen to have an import like this from cashondelivery.dashboard.app import application as cod_app and I have my url pattern as url(r'^dashboard/cod/', include(cod_app.urls)), but I got the following error in my terminal url(r'^dashboard/cod/...


How do I upgrade python 2.5.2 to python 2.6rc2 on ubuntu linux 8.04?

I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this. Thanks Dirk


macos - Upgrade Python to 2.6 on Mac

I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this. Thanks


macos - Trying to upgrade Python to 3.0 on Mac OS 10.5.8

I'm having some problems upgrading Python on my Mac. For my first attempt, I downloaded and installed the 2.6.4 dmg MacPython installer from http://python.org/download/mac/. This did install 2.6.4, and when I ran 'python' from the terminal it says that version. However, I also had a test script where I am doing: import os, json ...


macos - Python pip broken after OS X 10.8 upgrade

Made the upgrade to Mac OS X 10.8 (Mountain Lion) and get now the following error when trying to call $ pip: Traceback (most recent call last): File "/usr/local/bin/pip", line 5, in &lt;module&gt; from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in &lt;module&gt; working_set.requ...


upgrade python from 2.4 to 2.6 in plone

I am trying to upgrade my plone version from 3.3.5 to 4.0. For this I went to this site: updating plone. But I got stuck in the first point. In plone 3, I have python version of 2.4. But for plone 4.x I will need python 2.6. How do I upgrade my python version? In my buildout.cfg I have:


python - NumPy won't upgrade from 1.5.1 to 1.6.2 on OS X 10.7

I am attempting to update/upgrade my NumPy, but am failing. I think I might have multiple versions of NumPy installed in different directories, but python by default imports an old one. Any help? Here's where my Python is: Gonzo-vs-Kitties:~ brian$ which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python Here's the version that Python imports: Gonzo...


Upgrade Python 2.4 to 2.6 or 3.0

I am running Python 2.4 on Redhat Linux 5. Any idea how to upgrade to either Python 2.6 or 3.0? Thanks in advance, Sum


Should I upgrade python 2.7.3 to 2.7.4

The reason I ask is that some of the packages I have installed were specific to 2.7.3 as windows installers from PyPI. Would these need to be re-installed or would pip update these? Thanks.


python - Can't upgrade Scipy

I'm trying to upgrade Scipy from 0.9.0 to 0.12.0. I use the command: sudo pip install --upgrade scipy and I get all sorts of errors which can be seen in the pip.log file here and I'm unfortunately not python-savvy enough to understand what's wrong. Any help will be appreciated.


python - Upgrade to numpy 1.8.0 on Ubuntu 12.04

I'm running Ubuntu 12.04 which comes by default with NumPy 1.6.0 (I have, actually had, Python 2.7.3 installed). As a result of the answer to this question polyfit() got an unexpected keyword argument &#39;w&#39;, I need to upgrade it. I downloaded the .tar.gz packa...


How do I upgrade python 2.5.2 to python 2.6rc2 on ubuntu linux 8.04?

I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this. Thanks Dirk


macos - Upgrade Python to 2.6 on Mac

I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this. Thanks


macos - Trying to upgrade Python to 3.0 on Mac OS 10.5.8

I'm having some problems upgrading Python on my Mac. For my first attempt, I downloaded and installed the 2.6.4 dmg MacPython installer from http://python.org/download/mac/. This did install 2.6.4, and when I ran 'python' from the terminal it says that version. However, I also had a test script where I am doing: import os, json ...


How to upgrade the version of Python used by Apache?

On a Red hat box, I upgraded Python from 2.3 to 2.6.4 and changed the symlink to python so when I type in python the 2.6.4 interpreter comes up. However my .py file works from the command-line, but not in the browser. It seemed like a sys.path issue so I opened the file in a browser and printed out sys.path. Surprisingly, my sys.path is differ...


build - How can I upgrade the sqlite3 package in Python 2.6?

I was using Python 2.6.5 to build my application, which came with sqlite3 3.5.9. Apparently though, as I found out in another question of mine, foreign key support wasn't introduced in sqlite3 until version 3.6.19. However, Python 2.7 comes with sqlite3 3.6.21, so this work -- I decided I wanted to use foreign keys in my application, so I tried upgrading to python 2.7. I'm using twisted, and I couldn't for the life...


upgrade - How to make newest version of Python the default or first in path

I have installed a new version of Python, so I want to make sure when Python is invoked that version is first in my path. So, now on my 'C' drive I have "Python27" and "Python32" (old and new version, respectively). When I type "python" in the command line I get "Python 2.7". Using control panel I have changed the "path" and "pythonpath" user variables (from 'C:\Python27' to 'C:\Python32') and to be sure I have re...


macos - Python pip broken after OS X 10.8 upgrade

Made the upgrade to Mac OS X 10.8 (Mountain Lion) and get now the following error when trying to call $ pip: Traceback (most recent call last): File "/usr/local/bin/pip", line 5, in &lt;module&gt; from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in &lt;module&gt; working_set.requ...


upgrade python from 2.4 to 2.6 in plone

I am trying to upgrade my plone version from 3.3.5 to 4.0. For this I went to this site: updating plone. But I got stuck in the first point. In plone 3, I have python version of 2.4. But for plone 4.x I will need python 2.6. How do I upgrade my python version? In my buildout.cfg I have:


python - NumPy won't upgrade from 1.5.1 to 1.6.2 on OS X 10.7

I am attempting to update/upgrade my NumPy, but am failing. I think I might have multiple versions of NumPy installed in different directories, but python by default imports an old one. Any help? Here's where my Python is: Gonzo-vs-Kitties:~ brian$ which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python Here's the version that Python imports: Gonzo...


Upgrade Python 2.4 to 2.6 or 3.0

I am running Python 2.4 on Redhat Linux 5. Any idea how to upgrade to either Python 2.6 or 3.0? Thanks in advance, Sum






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top