Python Django official tutorial "Polls", beginner gets frustrating errors - python

I am trying to follow through the Python Django Tutorial from the official site.
However I find it hard to follow. I did everything as written but I got the following error"
ERROR screen caption
It sounds like something is wrong with the ENV, but I am not so sure why.
Also at the last line of error it said "include is not defined"...

You are missing the line from django.conf.urls import include, url.

Related

ModuleNotFoundError: No module named 'django_project.users'

** New user to SOF, sorry for poor post and thank you in advance for any help**
As the title says. I have been through multiple threads of StackOverflow with similar questions and none of them have given me a working solution.
My directories
The problem doesn't start until I add line18 into urls.py
and the error:
"ModuleNotFoundError: No module named django_project.users" is displayed.
I have tried different variations of importing the module and all seem to fail.
Traceback
I was following this tutorial:
https://www.youtube.com/watch?v=q4jPR-M0TAQ&t=753s
it wasn't until 14:00 where I was getting errors the author of the video was not. I have been following his tutorial from the beginning and have not run into any errors until now. I have been trying to find a solution for about 4 days now. Any help would be greatly appreciated.
I have pushed the most recent code to github and made the repository temporarily public for anyone who wants to replicate this problem:
https://github.com/ChristopherMillones/PyTest
EDIT: settings.py -> INSTALLED_APPS
django_project is your project root directory.
The apps inside are django_project, blog and users.
If you added those to your settings.py you have to import "stuff" from it like
from users.models import MyModel
In your project itself (django_project/django_project/*) you don't have a module users, that's why the error is thrown.

django-facebook api No module named 'django.conf.urls.defaults'

I installed django_facebook (django-facebook==6.0.3). I am using Django 1.11.
I got an error:
File "path/lib/python3.5/site-packages/django_facebook/urls.py", line 4, in <module>
from django.conf.urls.defaults import patterns, url
ImportError: No module named 'django.conf.urls.defaults'
I was tring solved this problem with:
try:
from django.conf.urls import include, url
except ImportError:
from django.conf.urls.defaults import include, url
but without success.
Please for hint.
django.conf.urls.defaults was removed in Django 1.6, which was many years ago, and the django-facebook package you're using has the following message in its README (which was committed two years ago):
Django and Facebook are both rapidly changing at the moment. Meanwhile, I'm caught up in a startup and don't have much spare time. The library needs a good round of testing against the latest python, django and facebook graph API.
Unless you're willing to dive deep into the package's code, I'd recommend looking for another solution. It sounds like the author is looking for someone to help maintain it. Good luck!

Pydev praw.Reddit error

I'm trying to create my first Reddit bot using the praw package. I'm coding in Pydev for Eclipse.
I'm getting an error that I can't figure out how to resolve. When defining an instance of Reddit, I'm using this line of code:
reddit = praw.Reddit('bot1')
That's the format I have seen in a bunch of code examples from a bunch of different sites.
Pydev is giving me the following error message:
Undefined variable from import: Reddit
I can't find any source that shows how to resolve this issue. I'd appreciate some help.
EDIT:
Though the error message remains, I can still run the bot without issues. I don't understand why that would be, and would still like to know if I should try to fix something, but am glad it works.
Have you tried adding praw to the forced builtins? (to force it to be dynamically analyzed through a shell)
See: http://www.pydev.org/manual_101_interpreter.html#PyDevInterpreterConfiguration-ForcedBuiltins for more details on the matter.

Django lack detail of error

Django is not giving me detailed information about the error.
For example when I get ImportError, I can not see where the error is comming from. Which file which line. It only gives me ImportError: cannot import name ___. But it is not enough to find where the error is. It is not only about ImportError.Many error is given to me with lack of detail like that. I am really bored with searching where is the error and it takes my time.
Is there a way to make it to give me more information about error in DJango.
I am using python==2.7 and django==1.5.3.
Set DEBUG = True in your settings.py and start your server with python manage.py runserver --traceback

Djangobb problem

I've installed Djangobb app on my server (Debian, mod_python) by cloning original source. The only things I've changed is database options in settings.py. All needed components are installed - syncdb query was executed right.
But, when I'm trying to enter on my forum, it returns me error:
ImproperlyConfigured: Error importing middleware django_authopenid.middleware: "No module named djangobb_forum.subscription"
I've checked - djangobb_forum/subscription.py exist, so I don't know what can be wrong.
Maybe someone had problems like that and know how to fix it?
Sorry for my english.
There are two obvious reasons to why this might happen:
djangobb_forum is not on your Python path
There is no __init__.py in the djangobb_forum folder
If the code says from djangobb_forum import ... then you need to have the parent folder of djangobb_forum on your Python path.

Categories

Resources