currently I facing an issue to create two django projects parallel working on one server system.
Konfiguration:
nginx ubuntu server such as 1.1.1.1
django project 1 such as 1.1.1.1/admin with Port 8000
django project 2 such as 1.1.1.1/demo/admin2 with Port 9000
Currently if I start both (django project 1 and 2) manage.py runserver successful and if I change path("admin/", django.contrib.admin.sites.urls) to path("admin2/", django.cotntrib.admin.site.urls) this gives me the Not Found Error.
Is there any way to use two django projects parallel on one server in a different GitHUb folder structure and the same IP ?
Related
I cannot access localhost / 0.0.0.0:8000 from any other device.
The current django project is built off of an older project I was playing around with last year where this worked. Unfortunately i've lost the previous project so I cannot compare their settings.py files, although there should be hardly any difference between them.
.
The setup
Dropbox - holds project and sqlite database file
Laptop - running
server, had no changes over last year
Desktop - /
iPhone - /
.
Where the problem is
The fault must be on my laptop where the server is running because I cannot access the server on either my desktop nor my iPhone, the latter worked last year with the previous project, I did not have my desktop at the time.
.
The project's allowed hosts list
I've added several as i've been trying out different solutions recommended by others.
ALLOWED_HOSTS = [
'*',
'0.0.0.0.',
'0.0.0.0:8000',
'localhost'
'localhost:8000'
'{laptop's IP address}',
'{desktop's IPv4 address}',
'{desktop's Default gateway}',
]
.
When I try to access the localhost on desktop or iPhone
Nothing appears in the laptop's terminal, the quit server help line remains the last line. I remember last year, it would update with notifcations that something remotely was accessing the server.
On the desktop, Firefox tells me it's 'Unable to connect', Edge tells me 'localhost refused to connect' with a 'ERR_CONNECTION_REFUSED'.
On the iPhone, 'could not connect to the server'.
.
what I've tried in the other devices' URL address bar
0.0.0.0:8000
localhost:8000
localhost:8000/admin
https://{laptop IP address}
.
.
Any help would be appreciated.
To host on a local network, first ensure that your IP address is added to the ALLOWED_HOSTS of settings.py.
ALLOWED_HOSTS = ['192.168.1.X']
Note: Your IP address can be locate via running ipconfig in the command prompt
Ensure you also execute runserver on ip address 0.0.0.0:8000. For example:
python manage.py runserver 0.0.0.0:8000
When connecting with other devices put the IP address and the port number of the host in the URL within the browser. Like so:
192.168.1.X:8000/<app_name>/other_pages
I'm currently testing Django on Codenvy but I have difficulties to find out how to connect to the build-in development server of Django.
I added a server in the Workspace configuration with port 8000 and http protocole.
I added the following in the run command of Codenvy's project :
Commande line :
cd ${current.project.path} && python manage.py runserver
Preview :
http://${server.port.8000}
The run prompt provide me a url : http://nodexx.codenvy.io:xxxxx
Going to this URL print a message : ERR_CONNECTION_REFUSED
I'm very new to all of this. Do you know what is missing ?
Django dev server by default accepts connections only from localhost. In order to access it from another machine, start runserver by binding it with an IP, or 0 for the app to be accessed from everywhere.
python manage.py runserver 0:8000
The above command runs the server in 8000 port, binding the network to 0.0.0.0, which means the app can be accessed from anywhere
Read through the other threads, but none seemed to address my need.
I have a website running fine on default port 80/443 using Apache on CentOS 7.
I have now installed gunicorn and copied my files to a /api subdirectory on the server. I am able to start gunicorn successfully using "gunicorn -b 0.0.0.0:8000 api:app"; however, I don't seem to be able to browse to https://example.com:8000 (site can't be reached).
Do I need to use a VirtualHost's file specifically for the Flask /api directory? If so, what would that look like without disrupting the main site?
EDIT: Note this is a Flask-RESTful API, no static files or anything on the Flask side. Just endpoints/routes to serve.
Please, I need to configure Django Channels on redis-channel-layer on windows IIS in production. It is running very well in development.
I have installed redis, daphne. I have set the IIS as proxy server with URL Rewrite pointing the Inbound to localhost 6379 to redis-layer channels. I used python manage.py runworker. and also started the daphne server with the daphne command.
They all ran very well, but there is no websocket handshake for my url.
We have a dev server with the internal hostname dev1.internal.blah.com running nginx. I'm trying to create a test Django project testproject from the Django tutorial on this server. I access this server by ssh-ing into it.
So on this server I installed Django, created a new directory, issued django-admin startproject mysite within it, then issued python manage.py runserver 8765 and got the
success message Starting development server at http://127.0.0.1:8765/
Now how would I access the http://127.0.0.1:8765 site from a browser? I tried using http://dev1.internal.blah.com:8765 but got a This site can't be reached error message.
If I try curl http://127.0.0.1:8765 from the terminal, I see the correct html being rendered.
The nginx www directory is located at /usr/share/nginx/html if it helps.
By default, Django development server runs on port 8000 on the IP address 127.0.0.1, but note that that IP address is accessible only from your own server.
To make the runserver viewable to others, use either its own IP address or 0.0.0.0. or :: with IPv6 enabled.
So, you should probably run it like this:
python manage.py runserver 0.0.0.0:8765