ToofPy is a python server that supports WSGI so you can integrate Django with it via the WSGI handler.
There is already some default Django integration in the source, but it looked really hacked up with many if hasdjango:
lines all over the place and hardcoded URLs.
A really simple solution is to create a Tool for wrapping around Django. That is what the above file does. So I removed most of the hardcoded django lines and created the tool above.
ToofPy dynamically loads tools based on paths on the filesystem, so you'll need to put the file above in the WSGI folder path.
Or, if you want to pre-integrate, import the file in the _initops function of WSGIMainTool just after the code to scan the directory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Put the contents below into a file DjangoWsgiWrapper.py and put it in your
# WSGI Tool directory
# If you want to pre-integrate it (ie not have it picked up from the
# filesystem), then add "import DjangoWsgiWrapper" to the _initopts function
# in WSGIMainTool (WSGITool.py)
import os
from django.core.handlers.wsgi import WSGIHandler
# replace with your settings file
os.environ['DJANGO_SETTINGS_MODULE'] = "apps.settings"
# replace "app" with the name of your app.
# You will access django by going to http://yoursite/WSGI/app
registerWSGI('app', WSGIHandler())
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 10 months, 2 weeks ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 3 weeks ago
- Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
- Help text hyperlinks by sa2812 1 year, 7 months ago
Comments
Please login first before commenting.