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

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!

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.

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

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?

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

Not able to deploy Django app on AWS Lightsail using Apache server based on provided tutorial

I followed the tutorial (https://aws.amazon.com/getting-started/hands-on/deploy-python-application/) on deploying Django website in AWS Lightsail. When I use the
python3 manage.py runserver 0.0.0.0:8000
to deploy the website then it works perfectly and I can access the website at http://AWS.INSTANCE.PUBLIC.IP.ADDRESS:8000
However, if I follow the Host the application using Apache part of the same tutorial, I am getting the following error when I try to access http://AWS.INSTANCE.PUBLIC.IP.ADDRESS:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator at you#example.com to inform
them of the time this error occurred, and the actions you performed
just before this error.
More information about this error may be available in the server error
log.
How to successfully deploy the Django website/app using Apache on AWS Lightsail instance?
I was able to run Django on lightsail by following the tutorial.
Make sure all paths in bitnami.conf file is correctly configured. Also, you need to retain the below part.
# Let Apache know we're behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto https HTTPS=on
This is the part where the tutorial asks to delete but don't delete this part. Below this part, should start.
If you were able to put up the correct paths, you should be able to run Django application on LightSail.
However, there is a bigger problem later on when you try to get HTTPS on lightsail instance;;;

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.