I am using Django and Django Suit V2 -
I am trying to create a custom home page for my django site using templates.
I keep getting this error: File "/usr/local/lib/python2.7/dist-packages/suit/apps.py", line 89, in add_suit_default_template_tags from django.template.engine import Engine
ImportError: No module named Engine
I want to make sure of what I'm doing before I go in and mess with the main files.
Anyone else deal with "No module named Engine" error before? Any Suggestions?
UPDATE - ok I corrected the first issue - I made sure the python interpreter was pointing to the virtualenv (it was already activated, so I deactivated and then reactivated). Was able to do a collectstatic with no error. I have now generated a different error which I will post in a different question since it's not directly related here. :)
It sounds like you have an old version of Django installed. The import
from django.template.engine import Engine
should work in Django 1.8+.
Related
django works well on my local machine. But, when I deploy it to heroku, I see "ModuleNotFoundError" "No module named '_tkinter'". Though, I never imported "_tkinter" or "tkinter" in my code. Your help will be appreciated. Thank you.
ModuleNotFoundError at /
No module named '_tkinter'
Request Method: GET
Request URL: https://howididit.herokuapp.com/
Django Version: 4.0.6
Exception Type: ModuleNotFoundError
Exception Value:
No module named '_tkinter'
Exception Location: /app/.heroku/python/lib/python3.10/tkinter/init.py, line 37, in
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.10.5
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python310.zip',
'/app/.heroku/python/lib/python3.10',
'/app/.heroku/python/lib/python3.10/lib-dynload',
'/app/.heroku/python/lib/python3.10/site-packages']
If you don't use Tkinter, just remove it from /forms.py. otherwise it'll be imported.
If you want to use tkinter,then consider the below process
please try adding tkinter to your requirements.txt. If it fails, even after that, check if you have added Python buildpack. If both the cases pass, try shelling into your Heroku instances and run the following command:
sudo apt install python3-tk
This will install Tkinter library in your instance of Heroku. That will resolve your error.
I found out these from pyexpat import model from turtle import title from attr import fields where imported in my forms.py. After deleting them, The problem was solved. Again, thank you all guys for your time, I really appreciate it.
Okay so for anyone looking at this in the future and banging their head against the desk...this is what worked for me:
I started with a new Hello World app and started adding bits of my original code until i got to the error
found out that one of the modules I was using : icu, was using tkinter and i needed to install the Pyicu module instead
pip installed directly into heroku bash console instead of through my app
None of the answers i found online had worked for me, and I think its because this error isnt from having tkinter directly in your app, but from another module thats calling it.
When in doubt do what I did and start a new project from scratch and add chunks of code until you get the error to see which module is creating it
Dont forget to change DEBUG to False in your settings file
I am trying to use the Sign in with SteamID snippet from the Flask site. However, I get ImportError: No module named flaskext.sqlalchemy when I try to run it, and PyCharm says Uresolved reference "flaskext" and Uresolved reference "OpenID". I re-installed Flask-OpenID and Flask-SQLAlchemy to make sure they were there. Why am I getting this error and how do I fix it?
That snippet is really old. flaskext is no more (or at least very deprecated). Refer to packages directly rather than through flaskext or flask.ext.
from flask_sqlalchemy import SQLAlchemy
Flask-SQLAlchemy (and most other extensions) no longer register in the flaskext namespace, and flask.ext was deprecated then removed in 1.0. The only correct way to refer to extensions now is by directly importing them.
If you're still getting an import error, then you didn't install the package in the same Python environment you're running. Make sure you're using a virtualenv.
I'm building a project that uses django-app-engine, but get some import errors when running the project with the GAE launcher.
My first error is importing simplejson, same as: Error importing simplejson after upgrading to appengine dev server 1.7.6
I've resolved that issue by modifying old_dev_appserver.py in the GAE bundle to import 'json' instead of 'simplejson' (I hope it's ok that I modified the GAE bundle..)
After the change, I receive a new error:
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/cron/groc.py", line 31, in <module>
import antlr3
ImportError: No module named antlr3
In the link above, #trope actually commented on having the same issue, but I thought a new question would be better than adding comments to the original issue (which is resolved by changing simplejson to json)
As suggested here: Django App Engine can't find antlr3 module, I've tried to add
os.path.join(SDK_PATH, 'lib', 'antlr3')
And also tried to install the antlr3 runtime.
I feel this issue is different to the one above because it's a direct result of the simplejson workaround, but perhaps it is the same.
Python 2.7.2, GAELauncher 1.9.4
Any suggestions?
edit: I've also now tried the exact same setup/codebase on my PC with the latest version of Launcher, and I get the exact same two errors: first simplejson, then antlr3. Maybe that means it's an issue with the codebase/djangoappengine install?
OK, this should be solved. Make sure you have updated all the django nonrel projects (dbindexer, django, djangoappengine, djangotoolbox, and whatever else you use). Also, run gcloud components update from the command line.
In addition to adding os.path.join(SDK_PATH, 'lib', 'antlr3'), did you also actually download and install it? From the command line, run whereis antlr3.
I am trying to use the oauth2app library inside my Django app. I've tried installing the library several ways (easy_install, pip, pip via a requirements file, etc.), and every time it installs just fine. Also every time I can import the library from the Django shell (manage.py shell).
However, when I try to use a view from the library:
(r'^oauth2/token/?$', 'oauth2app.token.handler'),
I get a "No module named oauth2app" import error. I've tried comparing the Python path from the Django debug page to the one from "print sys.path" inside the shell, and the seem to be the same, so I can't for the life of me figure out why one works and the other doesn't.
Can anyone help explain what's going on? I thought the Django shell was an equivalent environment to the Django instance ...
Nevermind, it looks like this was just a case of bad documentation on the library's site; when I changed the urls.py line to:
from oauth2app import token
...
(r'^oauth2/token/?$', token.handler),
it worked, sigh.
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.