Server Conflict when running two Django projects simultaneously
Question:
I am currently working on two Django project at the meantime.
However, I am not able to switch my server from one to another. When I am running the server of http://127.0.0.1:8000/, it keeps showing the old website but not able to access the new one.
I have searched for a number of solutions and I found this python package "django-livereload-server"
https://github.com/tjwalch/django-livereload-server
I followed this method strictly but it doesn’t work.
The following error message was shown when I run python manage.py runserver
Watching for file changes with StatReloader
Performing system checks…
System check identified some issues:
WARNINGS: ?: (urls.W005) URL namespace ‘admin’ isn’t unique. You may
not be able to reverse all URLs in this namespace
System check identified 1 issue (0 silenced).
You have 1 unapplied migration(s). Your project may not work properly
until you apply the migrations for app(s): f lights. Run ‘python
manage.py migrate’ to apply them. June 16, 2021 – 19:11:02 Django
version 3.2.4, using settings ‘airline.settings’ Starting development
server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK.
Is it the problem of my code or what’re the problems
Edit: the problem is caused by both servers are running on the default port 8000
It can be solved by running the command python manage.py runserver Replace with an actual port number. Now both will be accessible at once on their respective ports.
Reference: https://github.com/tjwalch/django-livereload-server
Answers:
As you have not provided much information in regards to your second development server, I have to assume here.
I am assuming you are running the command python manage.py runserver
on both applications. This will cause conflict with the original server as they will both default to port 8000
.
You can avoid this by running the command python manage.py runserver <PORT>
Replace with an actual port number. Now both will be accessible at once on their respective ports.
https://github.com/tjwalch/django-livereload-server I believe this will just run your server as if in production and not solve the issue you are having, so this is incorrect for your needs.
Hope this solves your issue.
I am currently working on two Django project at the meantime.
However, I am not able to switch my server from one to another. When I am running the server of http://127.0.0.1:8000/, it keeps showing the old website but not able to access the new one.
I have searched for a number of solutions and I found this python package "django-livereload-server"
https://github.com/tjwalch/django-livereload-server
I followed this method strictly but it doesn’t work.
The following error message was shown when I run python manage.py runserver
Watching for file changes with StatReloader
Performing system checks…
System check identified some issues:
WARNINGS: ?: (urls.W005) URL namespace ‘admin’ isn’t unique. You may
not be able to reverse all URLs in this namespaceSystem check identified 1 issue (0 silenced).
You have 1 unapplied migration(s). Your project may not work properly
until you apply the migrations for app(s): f lights. Run ‘python
manage.py migrate’ to apply them. June 16, 2021 – 19:11:02 Django
version 3.2.4, using settings ‘airline.settings’ Starting development
server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK.
Is it the problem of my code or what’re the problems
Edit: the problem is caused by both servers are running on the default port 8000
It can be solved by running the command python manage.py runserver Replace with an actual port number. Now both will be accessible at once on their respective ports.
Reference: https://github.com/tjwalch/django-livereload-server
As you have not provided much information in regards to your second development server, I have to assume here.
I am assuming you are running the command python manage.py runserver
on both applications. This will cause conflict with the original server as they will both default to port 8000
.
You can avoid this by running the command python manage.py runserver <PORT>
Replace with an actual port number. Now both will be accessible at once on their respective ports.
https://github.com/tjwalch/django-livereload-server I believe this will just run your server as if in production and not solve the issue you are having, so this is incorrect for your needs.
Hope this solves your issue.