ImportError: No module named locallibrary.settings - python

You could have seen the question so many times.
But unluckily I cant solve this error.
I am using python 2.7.12 , django 1.8
The tutorial source I learn is Mozilla django development where they teach with latest version of python3 and django 1.10
Somehow I tackled to use with older version.
everything was going good until I started to import models to admin.
soem class codes started showing that it has no object member, even though it exist
and hence I finally got the error as
"ImportError: No module named locallibrary.settings"
Here what I tried:
Updated to python 3(thought that could be the problem)
appended correct sys path() with project path.
Still same error showing up
Anybody help me out for solving the issue.

If you are trying to import the settings of your project, try importing
from django.conf import settings

Related

Heroku release fails, error related to django.utils

So I updated my python code to Django 4.0 and with that, had to remove and update some deprecated code as "ungettext_lazy" and similar.
Locally, the code is compiling well but when I push it to heroku, I get this error:
from django.utils.translation import ungettext_lazy
ImportError: cannot import name 'ungettext_lazy' from 'django.utils.translation' (/app/.heroku/python/lib/python3.9/site-packages/django/utils/translation/__init__.py)
I've tried a few things but haven't been able to update this on heroku.
Basically solved it by removing the django-url-filter lib as it's not supporting django 4.0. Since I only used it for a small piece of code, it was better to remove it.
I solved this issue by swaping manually on requirements.txt Django==4.1 to Django==3.2.

Python not able to import any module

I don't know whether I've just installed them wrong or there's another problem. I installed the ebay sdk but whenever I try to import it I get
ModuleNotFoundError: No module named 'ebaysdk'
Are there any common problems with this I could check for a solution? It shouldn't be the code as I copied it from the example code off the website.
Thanks for any help.
P.S I'm using 3.6

Python 2.7.9 troubles importing pysftp

I've been having troubles import pysftp. I currently have a server running some python scripts on a database, and decided to try and update this module which some of the scripts use. It broke a bunch of the scripts and then I had to go back and fix the versioning and to allow everything to function.
So far the only module I'm not able to import or use is pysftp. It throws the attached error. I've tried going into sites-manager and removing the files from there, however it has yet to help. Everything else has been working. Updating doesn't work either.
Any indication on how to resolve this error is greatly appreciated.
Error is:
ImportError: cannot import name util
I haven't been able to find a package called util to install. Please help! Attached link is of the trace.
http://imgur.com/a/9lQUj

django-1.10 still contains deprecated and removed features

I am trying to run an existing django app. The app has been built in django-1.10. I set up a new virtualenv and installed the requirements and everything. However, I get errors like the following:
from django.utils import importlib
ImportError: cannot import name importlib
Now, the above is from the following source - .virtualenvs/crowd/lib/python2.7/site-packages/account/conf.py
When I manually fix the conf.py file, I still keep getting errors to fix either deprecated or removed features from older django versions.
Any idea as to how to fix this? I thought the purpose of working in virtualenvs was to avoid such errors.
Any suggestions would be much appreciated. Thanks in advance!
This is how the question is different: Even after I fix the importlib import statement, it keeps giving me errors like that of the usage of SubFieldBase and so on.
The problem was not with the Django-core but with django-user-accounts app that was included with pinax. Upgrading the django-user-accounts app fixed the issue.
Thanks to #Selcuk for the solution.

No module named backends.default.urls

So I've installed django-registration through easy_install. I'm following a quick start guide and I'm trying to setup my urlConf, however it says module named backends.defauls.urls is not found. What might be the problem ?
import registration
(r'^accounts/', include('registration.backends.default.urls')),
(not my solution, but since it was hidden in a comment)
You need to use use include('registration.urls'),
instead of include('registration.backends.default.urls')
Is the registration module in your PYTHONPATH?
I'd suggest always getting django-registration from Bitbucket: https://bitbucket.org/ubernostrum/django-registration/overview.
I had a similar problem where I installed django-registration using pip install and it wasn't giving me up-to-date code.
I had the same problem. Apparently the server where I'm trying to upload the urls.py script has an older version, 0.7 I think.
My initial workaround was to put django-registration as an app (from the source) and include it in INSTALLED_APPS, with the registration folder right alongside my other apps.
Then the new problem was that the installed version is being looked up before the 'custom' app, especially on imports. For example, in views.py, we have an
from registration.backends import get_backend
which seems to be missing from the 0.7 version. So this raises an exception, but checking on the registration app the function is there in registration/backend/init.py.
This causes clashes between the custom registration app (0.8) and the one installed server-wide (0.7) that I can't seem to get around to.

Categories