Attaching oTree(Django) to IIS with Windows VM using Hypercorn or equivalent? - django

I have been looking into adding oTree to a website hosted in Windows 2012 IIS on a Windows 10 VM.
To run locally I just run otree prodserver inside the directory of the apps folder.
The app runs on localhost:8000 unless specified otherwise, which allows me to generate unique urls for players on the local network.
When looking at attaching to the IIS so it can get ran using a URL on the cloud remotely, not sure how to go about it.
With Django attaching the wsgi and enabling it to the IIS. Inside oTree no file exist. It seems to use Uvicorn and Scarlett to run asynchronously with ASGI server.
From what I can tell it would be easiest to use Hypercorn and run it with a web.config file. But that's where I am lost.
I'm not sure where the ASGI module/app is to execute with Hypercorn.
Can I just run a CLI with otree prodserver and attach that to Hypercorn to host the localhost:8000 on the IIS with a proxy?

Related

Not able to run Django website without port 8000(for eg: website.example:8000) using cyberpanel and openlitespeed

I am trying to host website on cyberpanel with openlitespeed server, CentOS operating system. but whenever I am trying to make the project live it is not coming on the specified domain but running only on the example.com:8000.
I did all the changes in the settings.py file related to project.

How to run a Django's application server on a VPS server

I have an application that should run via VPS terminal-based so that the web app can be online permanently.
The command: python manage.py runserver 173.249.8.237:8000 should be executed via the VPS terminal because when I use putty via my laptop, whenever I switch off my putty software via my laptop, the application won't be accessible.
Please, suggest to me a way open a terminal in order to run the Django application server.
Or, is there any method that can allow me to my Django web application on VPS?
Thanks in advence
Don't do that.
runserver according Django Docs
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone
through security audits or performance tests. (And that’s how it’s
gonna stay. We’re in the business of making web frameworks, not web
servers, so improving this server to be able to handle a production
environment is outside the scope of Django.)
You need to configure your Django application to run in production environments. You change choose docker for that.
Or simple running with gunicorn.
Access your VPS through SSH or Putty.
Copy your application code inside VPS
Configure your application to run with gunicorn or docker
Access your VPS address in your browser.
And turn of the DEBUG mode, by setting DEBUG=False

Strategic error on Python/Flask deploy

I'm new to web development and deployment however I developed a web site using Python 2.7 and Flask. I can't get the site to load when the user hits the site. When testing on the server using SSH the program starts like it did on my development PC but does not render the first template and shows this error: WARNING: Do not use the development server in a production environment. Use a production WSGI server instead.
In researching that error I found an article that says Flask is not meant for a multi-user public web environment. Further investigation said: If you want to run Flask in production, be sure to use a production-ready web server like Nginx, and let your app be handled by a WSGI application server like Gunicorn.
I think what this is telling me is:
Find a provider that supports Nginx.
Install Gunicorn and then configure it to run on that host.
Doing that should allow my program to run on the host server and be accessible to the world.
Would folks with experience with Python/Flask web apps please confirm the direction I should be heading as I can't afford to go down the wrong path again.

Django's development server on Ubuntu not accessible via browser, only via -curl

I am trying to set up a Django website on an Ubuntu server hosted on DigitalOcean.
After following the step-by-step DigitalOcean tutorial here: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
I remain stuck as I cannot seem to access Django's development server launched on 0.0.0:8000 with the browser of my local machine. However, I do have a response using -curl from the server's bash terminal. So it seems it can only be accessed from the server itself. Django does not return any error while launching the development server. It lists successful connections (code 200) every time I access it via -curl, but does not show anything when I try to access it via my external browser, as if it is actually not being acecssed.
What I did:
followed this tutorial step-by-step until the launch of Django's development server,
disabled Ubuntu's firewall and no DO firewall is used
added '*' in ALLOWED_HOSTS in settings.py
Any ideas? Thank you very much!

Django Deployment on windows

I am learning python and Django now. I have a question related to deploying Django project on windows 7. I know how to start the test server in django and see the project. But I have to do start the server manually every time I restart the PC. Also I have to keep the terminal window open.
Consider the below scenario for php projects.
We copy and paste the php files in htdocs or www folder in apache server and access them using the respected url. Web Server is running in the background. We dont have to start the server on windows restart.
Is something similar possible with Django on apache or any other server?
If yes, how should I go about it?
Thanks in advance.
For anyone stumbling around for an answer to a similar problem with deploying Django on a Windows server, here is a guide
Deploy Django with Apache and mod_wsgi on Windows Server 2019
To have Apache24 service automatically run on startup, make the changes in Windows Services dialog.