When I run from flask.ext.mysql import MySQL I get the warning Importing flask.ext.mysql is deprecated, use flask_mysql instead.
So I installed flask_mysql using pip install flask_mysql,installed it successfully but then when I run from flask_mysql import MySQL I get the error No module named flask_mysql. In the first warning I also get Detected extension named flaskext.mysql, please rename it to flask_mysql. The old form is deprecated.
.format(x=modname), ExtDeprecationWarning. Could you please tell me how exactly should I rename it to flask_mysql?
Thanks in advance.
flask.ext. is a deprecated pattern which was used prevalently in older extensions and tutorials. The warning is telling you to replace it with the direct import, which it guesses to be flask_mysql. However, Flask-MySQL is using an even more outdated pattern, flaskext.. There is nothing you can do about that besides convincing the maintainer to release a new version that fixes it. from flaskext.mysql import MySQL should work and avoid the warning, although preferably the package would be updated to use flask_mysql instead.
flask.ext.X is the old form to import a Flask extension, it is deprecated since Flask v0.10. The new way is to use flask_X. That's why you got the first warning.
But apparently, Flask-MySQL does not update it's name form and use the flaskext as the package name (chedck it on GitHub). That's why you got the second warning.
Related
This problem occurs when I run Django.I guss it related with kms-client-sdk==0.1.5
You probably miss package or use wrong package (or packages) version.
Read changelogs and try to find the issue (also I recommend using GitHub issues section).
I think also you should post your exact error trace, because that gives possibility to find the certain broken library.
I have been trying to use the django-visits module, though I seem to not even get this to run cause the minute I follow the instructions for just adding it to my application here:
https://bitbucket.org/jespino/django-visits/src/c3ac83b91969?at=default
It gives me an error when I try to run server:
ERRORS:
visits.Visit.ip_address: (fields.E900) IPAddressField has been removed
except for support in historical migrations.
HINT: Use GenericIPAddressField instead.
Their hint was helpful enough, but I have no idea where pip instaleld my django-visits to where I can change the model code of this module to fix the IPAdressField
Am I approaching solving this error wrong? Should I not be looking for the original code that was installed somewhere on my machine? Do I need to somehow install this from source and not use Pip since I have to change the models.py in this module?
(I am trying to make this work on my OS X machine but ultimately will need to get this to work on CentOS box). Also the database is postgres/postgis
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.
How to get module hgcr_ui in RhodeCode ? I have run it on my Windows box and I get an error like this:
failed to import extension hgcr-gui-qt: No module named hgcr_ui
however i can't access my repository too. I have downloaded https://bitbucket.org/glimchb/hgcr-gui too, but i still get an error like it.
RhodeCode uses it's internal equivalent of .hgrc files in database. The table rhodecode_ui, has one available extension (largefiles) you could add similar row with hgcr_ui to that table manually and that extension should now work with RhodeCode.
Make sure your Mercurial install is up to date. RhodeCode recommends a Python sandbox for itself, and that may have a different version.
I am using django-registration v0.7 and django 1.2.4. Everything works fine but I am wondering why I'm getting this warning message each time I run the server:
C:\Python26\lib\site-packages\registration\models.py:4: DeprecationWarning: the sha module is deprec
ated; use the hashlib module instead
import sha
Could be a problem in the future? Can I avoid it without changing django-registration original code?
EDIT
This deprecation warning comes up in Python 2.6.2
No, if it works, leave it. You can consider this something to think about when you upgrade to a new version of Python which actually removes this module.
Deprecated means that you are encouraged not to use it in new code, it doesn't mean you need to modify (and hence break) existing code which uses it.
you should create new issue/ticket/bug on project's site, or report this to developers of the project.
if there is no activity in project, you are free to fix the code locally.
i had the same problem and kept getting mail about a cron job which was throwing deprecation warning so i ran my python script with
-W ignore::DeprecationWarning
since the script is running in a virtualenv which won't be moving to py3k i can live with this
This deprecation warning comes up in Python 2.6 and django-registration v0.7, it dissapears upgrading django-registration to v0.8