Reputation: 35
In urls.py, which is in 'users' folder, which is containing migrations folder, localhost: 8000 /users is scripted. Then I typed http GET localhost:8000 on the command line after which Virtual environment had been activated. But It prints this error.
http: error: ConnectionError: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10172bd60>: Failed to establish a new connection: [Errno 61] Connection refused'))
while doing a GET request to URL: http://localhost:8000/
What's the problem? I've been stuck into this step so I couldn't go forward anymore. Please give me some help!
Upvotes: 0
Views: 139
Reputation: 12514
Possible things that are missing:
first you try and run python manage.py runserver
in your settings ROOT_URLCONF='users/urls'
and then in your users
folder,
have urls.py
contain something like:
from django.http import HttpResponse
def demo_view(request):
return HttpResponse("Hello world.")
urlpatterns = [
path('', demo_view)
]
Now you can access https://localhost:8000/
in your browser.
mysite
folder), then it has a urls.py
where you'll need to include your users/urls.py
.then add to mysite/urls.py
's contents:
urlpatterns += [path('', include('users.urls'))]
Please be more specific with your question so people can give you better answer.
Upvotes: 1