unit
unit copied to clipboard
DirectAdmin Nginx Unit for Python Applications
Hi there, I'm using nginx unit available in the "Advanced Feature" panel in DirectAdmin.
I created zzzz folder to host my python app inside the public_html folder like
/home/xxxx/domains/yyyy/public_html/zzzz/
and put the following sample python code and I make it readable and executable:
def application(environ, start_response):
start_response("200 OK", [("Content-Type", "text/plain")])
return (b"Hello, Python on Unit!")
I created an application:
When I want to create a route:
there is no template for python. Also, I have no idea what to put in the JSON part:
And when I click on create, it raises this error:
Morning @hosseinfani thanks for reporting this. We need to talk to the people responsible for the admin tool. Looks like something is wrong here. Are you able to create a support ticket? Feel free to link my mail address t.stark[at]nginx[.]com
@tippexs Thanks for your reply. How can I create a support ticket?
As the AdminPanel itself is not our software I can not say how they did implement Unit under the hood. I have found this link.
https://tickets.directadmin.com/new_ticket.php
This should work for you. Let me know if you need any more help.
Any update on this? I would like to get in touch with them to learn more about what they are doing with Unit.
Hi @tippexs We could solve the issue by the help from our administrator and the test python app runs successfully. I will post the change we did for others info soon.
Close due to inactivity. Please let us know if there is anything else we can do to help.
Hi @tippexs We could solve the issue by the help from our administrator and the test python app runs successfully. I will post the change we did for others info soon.
@hosseinfani Could you please elaborate how you successfully installed your python/django app. I have the same issue !
@maherchakroun
1- I shouldn't use the public_html
in the path for the static content as it was a shortcut to another place in storage. I had to use the actual folder path of the webapp. Something like /home/yourwebapp
2- In the configuration
, the home
path should be the virtual environment that all the python packages are installed. Somthing like /home/yourwebapp/venv
3- Last, in the app.py (your driver code), I did the following changes:
< application = app
< @app.route("/neucg/", methods=["GET", "POST"])
---
> @app.route("/", methods=["GET", "POST"])