I am using Django 1.8 on Jython in Windows 10. Have created a simple Django project following the tutorial https://docs.djangoproject.com/en/1.8/intro/tutorial01. After packaging using buildwar(including jars), when I deploy the mysite.war archive in tomcat, I get an error.
My project name is mysite, I have referenced the Jython path in web.xml.
My project structure is
-mysite
-WEB-INF
-lib
-jruby-extras-fileservlet.jar
-jython.jar
-lib-python
-django
-doj
-polls
-application_settingspy.class
-application_settings.py
-eggs.pth
-web.xml
-wsgi
Error is
Traceback (most recent call last):
File "D:\jython27\Lib\modjy\modjy.py", line 80, in service
self.exc_handler.handle(req, resp, wsgi_environ, mx, (typ, value, tb) )
File "D:\jython27\Lib\modjy\modjy.py", line 76, in service
self.dispatch_to_application(req, resp, wsgi_environ)
File "D:\jython27\Lib\modjy\modjy.py", line 92, in dispatch_to_application
app_callable = self.get_app_object(req, environ)
File "D:\jython27\Lib\modjy\modjy_publish.py", line 68, in get_app_object
return self.get_app_object_old_style(req, environ)
File "D:\jython27\Lib\modjy\modjy_publish.py", line 120, in get_app_object_old_style
return self.load_object(source_filename, callable_name)
File "D:\jython27\Lib\modjy\modjy_publish.py", line 142, in load_object
self.raise_exc(NoCallable, "Error loading jython callable '%s': %s" % (callable_name, str(x)) )
File "D:\jython27\Lib\modjy\modjy.py", line 121, in raise_exc
raise exc_class(message)
modjy.modjy_exceptions.NoCallable: Error loading jython callable 'application': No module named mysite
The application_settings file shows:
from mysite.settings import *
CONTEXT_ROOT = "mysite"
Related
ModuleNotFoundError
ModuleNotFoundError: No module named 'authlib'
Traceback (most recent call last)
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 184, in
find_app_by_string
app = call_factory(script_info, attr, args)
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 119, in call_factory
return app_factory()
File "/app/superset/app.py", line 44, in create_app
raise ex
File "/app/superset/app.py", line 37, in create_app
app_initializer.init_app()
File "/app/superset/initialization/__init__.py", line 616, in init_app
self.init_app_in_ctx()
File "/app/superset/initialization/__init__.py", line 564, in init_app_in_ctx
File "/app/superset/initialization/__init__.py", line 656, in configure_fab
appbuilder.init_app(self.superset_app, db.session)
File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/base.py", line 202, in
init_app
self.sm = self.security_manager_class(self)
File "/usr/local/lib/python3.8/site-
packages/flask_appbuilder/security/sqla/manager.py",
line 54, in __init__
super(SecurityManager, self).__init__(appbuilder)
File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/manager.py",
line 263, in __init__
from authlib.integrations.flask_client import OAuth
ModuleNotFoundError: No module named 'authlib'
The debugger caught an exception in your WSGI application. You can now look at the
traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on
the "Traceback" headline. From the text traceback you can also create a paste of it.
For code execution mouse-over the frame you want to debug and click on the console
icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra
helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
This is my directory structure: /home/directory/superset/superset-frontend.
I'm runnning superset in docker and I'm trying to get OAuth working.
I’ve edited the config file and added the OAuth configuration.
One of the lines I added was:
AUTH_TYPE = AUTH_OAUTH
This required me to import the auth types as below:
from flask_appbuilder.security.manager import (
AUTH_OID,
AUTH_REMOTE_USER,
AUTH_DB,
AUTH_LDAP,
AUTH_OAUTH,
)
When I try running npm run dev-server in development mode in superset.
I get the following error:
ModuleNotFoundError
ModuleNotFoundError: No module named 'authlib'
I was trying to create a new Django project in a new folder, located on the Desktop (Windows 7). But when I type django-admin startproject mysite in cmd I get this error. Can anybody help me with this?
C:\Users\Rovshan\Desktop\Django-examples>django-admin startproject mysite
Traceback (most recent call last):
File "c:\python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python34\Scripts\django-admin.exe\__main__.py", line 5, in <module>
File "c:\python34\1ib\site-packages\django\core\management\__init__.py", line
280
subcommands = [*get_commands(), ’help’]
^
SyntaxError: can use starred expression only as assignment target
It is a unpacking problem, you can fix this by upgrading your python version to 3.5
I don't understand the syntax to call the render feature of ERAlchemy (https://pypi.org/project/ERAlchemy see "Usage for Python"). I am using Python 2.7, sqlite3, and PyCharm. I have ERAlchemy, GraphViz, and PyGraphViz installed.
I am trying the following, but it cannot connect to the database:
from eralchemy import render_er
render_er("sqlite:///C:\\Users\\myname\\Documents\\Work\\pythonsqlite.db", 'erd_from_sqlite.png')
And this is the error:
Traceback (most recent call last):
File "C:/Users/myname/Documents/Work/_sql_functions_rev0.py", line 81, in <module>
render_er("sqlite:///C:\\Users\\myname\\Documents\\Work\\pythonsqlite.db", 'erd_from_sqlite.png')
File "C:\Python27\ArcGISx6410.6\lib\site-packages\eralchemy\main.py", line 236, in render_er
intermediary_to_output(tables, relationships, output)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\eralchemy\main.py", line 75, in intermediary_to_schema
graph.draw(path=output, prog='dot', format=extension)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1474, in draw
data = self._run_prog(prog, args)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1308, in _run_prog
runprog = r'"%s"' % self._get_prog(prog)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1295, in _get_prog
raise ValueError("Program %s not found in path." % prog)
ValueError: Program dot not found in path.
Ah! Found the answer here
had to find the folder with "dot.exe" and add it to the environment variables -> system variables -> path
I'm trying to intall the asterisk_click2dial module on ODOO and this error comes to me in the log file:
ValueError: Routing: posting a message without model should be with a parent_id (private mesage).
2015-03-09 15:23:38,262 11093 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
File "/home/odoo/odoo/lib/python2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/home/odoo/odoo/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/opt/odoo/openerp/service/server.py", line 281, in app
return self.app(e, s)
File "/opt/odoo/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/opt/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/opt/odoo/openerp/http.py", line 1274, in __call__
self.load_addons()
File "/opt/odoo/openerp/http.py", line 1293, in load_addons
m = __import__('openerp.addons.' + module)
File "/opt/odoo/openerp/modules/module.py", line 79, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/odoo/addons/base_phone/__init__.py", line 23, in <module>
from . import wizard
File "/opt/odoo/addons/base_phone/wizard/__init__.py", line 23, in <module>
from . import number_not_found
File "/opt/odoo/addons/base_phone/wizard/number_not_found.py", line 25, in <module>
import phonenumbers
ImportError: No module named phonenumbers
The problem is just that I installed that module (phonenumbers) plus the py-Asterisk module without errors using pip install phonenumbers and pip install py-Asterisk and the error persists.
I noticed I have at least two versions of python installed (2.6 and 2.7) but both modules are installed at the same version from odoo (I can see the modules in the python2.7 cli when, for example, I write phonenumbers or search).
Has anybody any idea what is happening to me? I'd be gratefull for some specific response. Thanks.
Here the connector's page: OpenERP - Asterisk connector
Ok, my bad. During odoo instalation I created a virtual environment under the Odoo system user account which was used solely by the Odoo server so I just need to install these modules under that enviorment. This works for me:
First let’s switch from root to the odoo user, then create a new virtual environment called odoo and activate it:
su - odoo
/usr/local/bin/virtualenv --python=/usr/local/bin/python2.7 odoo
source odoo/bin/activate
(If you have the virtual environment created like me just ignore the second line). Before starting the module installation we need to add the path to the PostgreSQL binaries, otherwise the PsycoPG2 module install will fail (I ignored this one too):
export PATH=/usr/pgsql-9.3/bin:$PATH
Then I can do pip install... Thank you all for your help.
I have done everything said on the following page.
https://help.ubuntu.com/community/Django
but it gives me an error page.
MOD_PYTHON ERROR
ProcessId: 2220 Interpreter:
'localhost.localdomain'
ServerName:
'localhost.localdomain' DocumentRoot:
'/etc/apache2/htdocs'
URI: '/' Location:
'/' Directory: None Filename:
'/etc/apache2/htdocs' PathInfo:
'/'
Phase: 'PythonHandler'
Handler:
'django.core.handlers.modpython'
Traceback (most recent call last):
File
"/usr/lib/python2.6/dist-packages/mod_python/importer.py",
line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File
"/usr/lib/python2.6/dist-packages/mod_python/importer.py",
line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File
"/usr/lib/python2.6/dist-packages/mod_python/importer.py",
line 1128, in _execute_target
result = object(arg)
File
"/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py",
line 228, in handler
return ModPythonHandler()(req)
File
"/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py",
line 191, in call
self.load_middleware()
File
"/usr/lib/pymodules/python2.6/django/core/handlers/base.py",
line 33, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:
File
"/usr/lib/pymodules/python2.6/django/utils/functional.py",
line 276, in getattr
self._setup()
File
"/usr/lib/pymodules/python2.6/django/conf/init.py",
line 40, in _setup
self._wrapped = Settings(settings_module)
File
"/usr/lib/pymodules/python2.6/django/conf/init.py",
line 75, in init
raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax
errors?): %s" % (self.SETTINGS_MODULE,
e))
ImportError: Could not import settings
'examples.settings' (Is it on sys.path? Does it have syntax errors?): No module named examples.settings
what could be wrong?
complete noob here.
If you are deploying django project for production under ubuntu server it is recommended to use WSGI. Just fallow the django documentation: https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/
Installing apache with wsgi under ubuntu is easy:
apt-get install libapache2-mod-wsgi
In case you just want to explore django you do not need to setup apache or anything. Just use manage.py runserver instead.