First django's website setting problem

I had installed django 4.0 and tried first website meetups that show “Hello world!”.
when entered localhost:8000/meetups, show
Using the URLconf defined in myproject.urls , Django tried these URL patterns, in this order:

admin/
The current path, meetups , didn’t match any of these.
You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False , and Django will display a standard 404 page.
When entered localhost:8000, show

The install worked successfully! Congratulations!
myproject.urls.py

   from django.urls import path, include
   # path(‘admin/’, admin.site.urls),
   path(‘meetups/’, include(‘meetups.urls’))
  ] ```

myproject.setting.py
```INSTALLED_APPS = [
   ‘meetups’,
   ‘django.contrib.admin’,
   ‘django.contrib.auth’,
   ‘django.contrib.contenttypes’,
   ‘django.contrib.sessions’,
   ‘django.contrib.messages’,
   ‘django.contrib.staticfiles’,
  ] ```

meetps.urls.py
```from django.urls import path
   from . import views
   urlpatterns = [
    path(’’, views.index) # our domain.com/meetups
   ] ```

meetups.views.py
```from django.shortcuts import render
   from django.http import HttpResponse
   # Create your views here.
   def index(reguest):
   return HttpResponse(‘Hello World!’) ```

I thought the code change in myproject.setting.py and myproject.urls.py don’t impact system reaction. The system has default code run some where else.

To keep your code formatted correctly, you put one set of ``` on a line by itself before the code, then another line of ``` on a line by itself after the code. You need to make sure you use the backtick character - `, and not the apostrophe.

Also, you don’t need to add another post to fix this - you can edit your original post.

Now, one thing that I think I can notice with what you have posted so far, you’re trying to access the url localhost:8000/meetups.
However, your urls.py file has the url defined as path('meetups/', include('meetups.urls')), which has a trailing slash. The url meetups is not the same as meetups/.

Hi Ken,

I followed your advice to update code, but no any change. I tried to save code, django broke down. My django version is 4.0.1, and python version is 3.8.8. is it possible python version is too old, or django one is too new? Thanks.

I don’t know what “update” you tried to make - there wasn’t anything needing to be changed in the code, just the url you were trying to access.

Also, again, for your posts here, do not put ``` at the beginning of every line.
You should have one line of ``` before the block of code and ``` after the block of code, not on every line.

Example:

# The line before this one is ```
def function(parm)
    return
# The line after this one is ```

Hi Ken,
Thanks. I am getting better.
Sorry , the code style has been updated following your rule.
Sorry. It’s not django system broke down, but the code has some problems. Sounds the updated code have to be saved manually by myself.
Now, the problem show: module ‘meetups.views’ has no attribute ‘index’, but I define index function there.
File “”, line 783, in exec_module
File “”, line 219, in _call_with_frames_removed
File “C:\Users\Li\DjangoProject\myproject\meetups\urls.py”, line 4, in
path(‘meetups’, views.index) # our domain.com/meetups
AttributeError: module ‘meetups.views’ has no attribute ‘index’

Have I installed django improperly?

Hi Ken,

Finally, I got it. It is working!
I checked the document for 4.0, and remove statement “from django.shortcuts import render” in meetups.views.py file.
I greatly appreciate your help. My many conjecture could go wrong ways as first touching django…

Best regards,

Jacob