Posted: 2025 03 09 13:45:34
Last modified: 2025 03 09 13:45:34
So richten Sie eine einfache Django-Anwendung ein
Voraussetzungen
pip install django
django-admin --version
django-admin startproject myproject
cd myproject
python manage.py runserver
python manage.py startapp myapp
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'myapp', ]
from django.http import HttpResponse def home(request): return HttpResponse("Hello, Django!")
from django.contrib import admin from django.urls import path from myapp.views import home urlpatterns = [ path('admin/', admin.site.urls), path('', home), ]
python manage.py runserver