request.get_host()
Maybe you could use nginx? Or if this is only for testing do something like:
for i in 1 2 3 4 5;
do manage.py runserver 10.0 .0.$i: 5000;
done
Django runserver bound to 0.0.0.0, how can I get which IP took the request?,For a django model, how can I get the django admin URL to add another, or list objects, etc.?,Using CKEditor on Django Blog, How can I get django to render the html from ckeditor?,Copyright 2022 www.appsloveworld.com. All rights reserved.
request.get_host()
Maybe you could use nginx? Or if this is only for testing do something like:
for i in 1 2 3 4 5;
do manage.py runserver 10.0 .0.$i: 5000;
done
Listening the same IP 0.0.0.0 shouldn't be a problem if it's on a different port. So the only way this should be hit is if Django somehow causes this code to be run more than once (or if that port number is actually used for something else).,The drawback is that now I have two different processes listening to the same port.,Does it make a difference if you also call ptvsd.wait_for_attach immediately after enabling? Maybe we can't listen on the same address multiple times, but once the connection is established it is fine.,I don't think this is a concurrent run, it's that Django itself is also trying to listen on 0.0.0.0 and this is apparently not working. That doesn't seem to make sense though - I'm sure we've done this before.
if os.environ.get('RUN_MAIN') or os.environ.get('WERKZEUG_RUN_MAIN'):
ptvsd.enable_attach(address = ('0.0.0.0', 7913), redirect_output = True)
You don't have to run using HTTP over port 8080, 8081, or 8082 with the IP of 127.0.0.1, localhost, or 0.0.0.0. However, you won't be able to preview your running application from within the IDE.,You can use the AWS Cloud9 IDE to preview a running application from within the IDE.,Before you can preview your application from within the IDE, it must be running in the AWS Cloud9 development environment using HTTP over port 8080, 8081, or 8082 with the IP of 127.0.0.1, localhost, or 0.0.0.0.,With your application already running using HTTP over port 8080, 8081, or 8082 with the IP of 127.0.0.1, localhost, or 0.0.0.0 in the environment, and with the corresponding application code file open and active in the AWS Cloud9 IDE, choose one of the following on the menu bar:
In a terminal session in the AWS Cloud9 IDE for the environment, run the following command to get the Amazon EC2 instance's ID.
curl http: //169.254.169.254/latest/meta-data/instance-id
In a terminal session in the IDE for the environment, run the following command to get the Amazon EC2 instance's public IP address.
curl http: //169.254.169.254/latest/meta-data/public-ipv4