Comments (8)
Yes, I wrote the same. All works fine if run as "manage.py runserver".
But if run project via uwsgi, raised following exception:
File "/home/shop/shop/settings.py", line 295, in <module>
jingo.env.install_gettext_translations(translation)
AttributeError: 'module' object has no attribute 'env'
But project running and works.
from jingo.
I work around this. I have gettext installation in the file of my private app jingoi18n/init.py
But for correct working it needs calling of admin.autodiscover() in urls.py of project. I think it's possible move instalation code to settings.py and it will works.
from jingo.
I try putting initialization code in settings.py already, same exception.
from jingo.
It looks like that exception has to do with jingo
not being imported correctly before running jingo.env.install_gettext_translations()
. The env
object is created as an import-time side-effect of the jingo
module. (Not a great way to do it, admittedly.)
runserver
imports everything in INSTALLED_APPS
when it runs model verification, so it works then. I'm guessing uwsgi doesn't have that init step. I've seen similar things with gunicorn and Raven, where I had to add a process start up hook to get the import-time side-effects.
How are you importing jingo in settings.py?
from jingo.
setttings.py:
import jingo.monkey
jingo.monkey.patch()
try:
from django.utils import translation
from jingo.import env
env.install_gettext_translations(translation)
except:
pass
from jingo.
env
isn't a module, but monkey
is. Try replacing the second import in the try:
block with:
import jingo
jingo.env.install_gettext_translations(translation)
from jingo.
Just tried. Same errror:
jingo.env.install_gettext_translations(translation)
AttributeError: 'module' object has no attribute 'env'
from jingo.
Can anyone who ran into this try with Jingo 0.8? There are some changes (there's no jingo.env
anymore, but jingo.get_env()
will return the instance) but the upgrade shouldn't be too rough.
from jingo.
Related Issues (20)
- No `override` for register.filter
- Bug in ability to use render_to_string() HOT 1
- JINGO_EXCLUDE_APPS + Django admin HOT 2
- datetime helper breaks on Windows HOT 2
- Django test fails with Jingo installed HOT 2
- Doesn't populate test data correctly HOT 3
- Circular Imports HOT 1
- helpers.f doesn't convert to string first as it used to HOT 5
- Review the need to monkey patch on modern Django HOT 2
- JINGO_EXCLUDE_APPS doesn't work with sitemap HOT 1
- Django 1.7 breakages HOT 3
- Please release a new version to PyPI HOT 6
- Django 1.7: AttributeError: 'module' object has no attribute 'StrAndUnicode' HOT 1
- Tag & release 0.8 HOT 11
- Jingo does not support django.contrib.admin.apps.SimpleAdminConfig
- Push 0.7 tag to GitHub HOT 1
- Add me to your committers or transfer the app over to Mozilla HOT 9
- Replace built-in helpers with Jinja extension
- Port to Django 1.9: ``from django.template.base import TemplateDoesNotExist`` ImportError. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jingo.