Heroku deploy Django application [duplicate] - django

This question already has answers here:
Error R11 (Bad bind) -> Process bound to port 8000, should be 25162 (see environment variable PORT)
(1 answer)
Getting "Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch" on python
(2 answers)
Heroku: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch - Python
(1 answer)
Deploying python to Heroku - Web process failed to bind to $PORT
(1 answer)
Closed 6 months ago.
I'm trying to launch my Django application with Heroku but when I execute the command "Heroku local" I get the following error .... Anyone can explain why?
Before writing this post I tried to make various changes and read up on the official website but it didn't work.
To run heroku in local I ran
Heroku local
in my main directory, with gunicorn everything was fine but apparently with heroku I'm doing something wrong.
I've also created a Procfile with the following line inside of it:
web: gunicorn social_site.wsgi
where social_site is the name of the app.

Related

Django Server Error: port is already in use, docker [duplicate]

This question already has answers here:
Docker & Postgres: Failed to bind tcp 0.0.0.0:5432 address already in use
(11 answers)
Closed 9 months ago.
When working with Docker and Django setup Initially sometime we will getting this error port 5432 already in use or TCP/IP not able to make connection. How to resolve this issue please find below.
This issue will happen because of two cases :
By suddenly stop or restart the system without closing the docker or DB to resolve it kill all PID ID by running this command kill -9 PID and kill all PID
Second issue was happening due to already in our system another Docker is present with same configuration then we have to change its name. along with it dont forgot to Inssert this line into settings.py DOMAIN_URL = config("DOMAIN_URL", "http://localhost:8000/") or DOMAIN_URL = "http://localhost:8000/"

Without server is it possible to run flask? [duplicate]

This question already has answers here:
Are a WSGI server and HTTP server required to serve a Flask app?
(3 answers)
Closed 12 months ago.
I have a flask application, and I want to run this application in production. Is it possible to do this without your own server and if yes where it is possible?
Yes, You can run the flask application through your own webserver such as Apache2 or Nginx hosted in your own server.
Check this out for more info
https://flask.palletsprojects.com/en/2.0.x/deploying/

How to share localhost port over local network [duplicate]

This question already has answers here:
Making django server accessible in LAN
(4 answers)
Closed 1 year ago.
I created webpage on local server with django framework (python). I have acces to it under address http://localhost:8000/. Now I want to share it over local network. I try to do it with Windows firewall Inbound/outbound rules, but it seems either I do something wrong or it's not enough.
To access a Django project running on a local network, you have to runserver with 0.0.0.0 as IP
python manage.py runserver 0.0.0.0:8000
and then set
ALLOWED_HOSTS = ["localhost", "yours_host_ip_aaddress"]
that should work if your firewall allows!
I am not sure how to suggest a duplicate question, but seems your question have an answer here. Basically, you need to ask the django program to accept connection from the outside world by
python manage.py runserver 0.0.0.0:8000

Nginx bad gateway error on some methods while other works

I am running Django on nginix but one of my functions is returning this error:
upstream prematurely closed connection while reading response header from upstream
While other methods are working fine.
I have traied increasing server timeout in nginx.conf file but still it gives me the same error.
This methods runs fine whe i run my django independently with
python manage.py runserver 0.0.0.0:8000
Can someone help me to resolve it?

How can I deploy a django+swampdragon realtime chatapp on heroku?

A simple django chatapp with swampdragon runs perfectly locally. But when I try to deploy it on heroku it shows "Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch" in the log. In the proc file I added "web: python server.py". which runs in the port 9999 locally. But how do I handle the port 9999 with heroku?
See this question:
Setting the port for node.js server on Heroku
You can't specify which port you want to use on Heroku.
Heroku sets it 'automatically' so you should read what the PORT variable is in the environment then use that.
heroku config:get PORT
references: https://devcenter.heroku.com/articles/config-vars