Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Django Tutorial
#1
I'm following the Django tutorial here -> https://docs.djangoproject.com/en/1.10/i...utorial01/ but I'm having problems. I can run python3 manage.py runserver and then point my browser to ipaddress:8000 and the Django start page shows up just fine. But after I get toward the bottom of the tutorial page where I am told to enter ipaddress:8000/polls I'm getting a 404 error but I noticed that it is showing that the server error is being hosted by a former django tutorial that I was working on a month or so ago, somehow it's still running and the browser will not pick up the new runserver instance so I can see my latest project.

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ ps -aux | grep python
dev      13340  1.2  6.9 595404 35356 ?        Sl   Nov27 236:12 /usr/bin/python3 manage.py runserver 104.131.10.230:8000
dev      25153  0.0  0.4  12728  2120 pts/2    S+   12:16   0:00 grep python
dev      27106  0.0  5.5  84164 28092 ?        S    Nov24   0:00 python3 manage.py runserver 104.131.10.230:8000

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ kill 27106

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ kill 27106
-bash: kill: (27106) - No such process
dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ ps -aux | grep python

dev      13340  1.2  6.9 595404 35356 ?        Sl   Nov27 236:12 /usr/bin/python3 manage.py runserver 104.131.10.230:8000
dev      25165  0.0  0.4  12728  2220 pts/2    S+   12:17   0:00 grep python

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ kill 13340

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ python3 manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

December 10, 2016 - 17:17:46
Django version 1.10.3, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.


As you can see there were to different processes of python3 manage.py runser running, one from a local and relative path and the other was running from the absolute path of /usr/bin/python3. I killed both processes but after restarting the server and going back to the browser I am now getting the error 'Unable to connect' Any idea on why after starting the server again I am getting 'Unable to connect' or what I can do about it. Also, any idea on how I'v had an instance of runserver running this whole time and why it took precedence over all other instances?
Reply
#2
(Dec-10-2016, 05:29 PM)lewashby Wrote: I'm following the Django tutorial here -> https://docs.djangoproject.com/en/1.10/i...utorial01/ but I'm having problems. I can run python3 manage.py runserver and then point my browser to ipaddress:8000 and the Django start page shows up just fine. But after I get toward the bottom of the tutorial page where I am told to enter ipaddress:8000/polls I'm getting a 404 error but I noticed that it is showing that the server error is being hosted by a former django tutorial that I was working on a month or so ago, somehow it's still running and the browser will not pick up the new runserver instance so I can see my latest project.

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ ps -aux | grep python
dev      13340  1.2  6.9 595404 35356 ?        Sl   Nov27 236:12 /usr/bin/python3 manage.py runserver 104.131.10.230:8000
dev      25153  0.0  0.4  12728  2120 pts/2    S+   12:16   0:00 grep python
dev      27106  0.0  5.5  84164 28092 ?        S    Nov24   0:00 python3 manage.py runserver 104.131.10.230:8000

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ kill 27106

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ kill 27106
-bash: kill: (27106) - No such process
dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ ps -aux | grep python

dev      13340  1.2  6.9 595404 35356 ?        Sl   Nov27 236:12 /usr/bin/python3 manage.py runserver 104.131.10.230:8000
dev      25165  0.0  0.4  12728  2220 pts/2    S+   12:17   0:00 grep python

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ kill 13340

dev@debian-512mb-nyc3-01:/var/www/html/django-tutorial/mysite$ python3 manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

December 10, 2016 - 17:17:46
Django version 1.10.3, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.


As you can see there were to different processes of python3 manage.py runser running, one from a local and relative path and the other was running from the absolute path of /usr/bin/python3. I killed both processes but after restarting the server and going back to the browser I am now getting the error 'Unable to connect' Any idea on why after starting the server again I am getting 'Unable to connect' or what I can do about it. Also, any idea on how I'v had an instance of runserver running this whole time and why it took precedence over all other instances?

1.  When you ran the " ... "runserver"... by the output I see that its was just a type bu since you are (seems to me ??) connecting and running django remotly, have you created a reverse tunneling to ur PC and enviroment?  or Is it local? or using virtual-point to host your django project?
2.  Given the output when you did " ... runserver", did you set up the settings for views? ALSO, you should run migrate ... retard the server hosting django and try again

EDIT: Being a local development, would you mind telling me exactly if after issueing migration command helped
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,218 Jun-30-2019, 12:21 AM
Last Post: scidam
  Lerning django 2.1, having problems with tutorial funkytwig 1 2,801 Mar-22-2019, 11:05 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020