Hi,
I am using UWSGI for a pyramid project with cassandra driver from datastax.
UWSGI works fine when ran as a server.
uwsgi --ini-paste development.ini
But pyramid also has some initializing scripts which load the app, before
starting the actions.like setting up a database etc..
How to import uwsgi while running Initialize scripts. ?
I have been importing uwsgi module in my main __init__ app to deal with
forking issue faced by cassandra once the server launches.
import uwsgi
from uwsgidecorators import *
@postfork
def connect_cassandra_client():
CaSession.connect(['127.0.0.1'], certificate='/path/here')
print("connection to cassandra made")
After adding uwsgi modules, none of the initialize scripts will be
functional, since these scripts don't know how to import uwsgi, which is
accessible only when ran from a uwsgi server.
Traceback (most recent call last):
File
"/home/izero/devel/xxxxxxxxxx/xxxxxxxxxx_env/bin/initialize_yyyyyyyyy_db",
line 9, in <module>
load_entry_point('yyyyyyyyy==0.0', 'console_scripts',
'initialize_yyyyyyyyy_db')()
File
"/home/izero/devel/xxxxxxxxxx/xxxxxxxxxx_env/lib/python3.4/site-packages/pkg_resources.py",
line 351, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File
"/home/izero/devel/xxxxxxxxxx/xxxxxxxxxx_env/lib/python3.4/site-packages/pkg_resources.py",
line 2363, in load_entry_point
return ep.load()
File
"/home/izero/devel/xxxxxxxxxx/xxxxxxxxxx_env/lib/python3.4/site-packages/pkg_resources.py",
line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/home/izero/devel/xxxxxxxxxx/yyyyyyyyy/yyyyyyyyy/__init__.py", line
26, in <module>
import uwsgi
ImportError: No module named 'uwsgi'
Does any one know how to deal with this issue ?
Srikanth
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi