Merge branch 'main' of github.com:Kum1ta/PTME_Transcendence

This commit is contained in:
madegryc pc
2024-08-18 00:05:43 +02:00
5 changed files with 26 additions and 14 deletions

View File

@ -1,4 +1,5 @@
from django.db import models
class TaMereLaPute(models.Model):
test=models.CharField(max_length=200)
id = models.AutoField(primary_key=True)
test = models.CharField(max_length=200)

View File

@ -23,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-vgcqdf^%(+@t*+cof@755e#q9p)myir%z2s*e*ea*v^i(4pta9'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
ALLOWED_HOSTS = ['*']
@ -31,12 +31,12 @@ ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'server',
]
MIDDLEWARE = [

View File

@ -2,21 +2,22 @@
URL configuration for server project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.urls import path
from . import views
urlpatterns = [
path("",views.index, name='patate')
path("",views.index, name='patate'),
path("set",views.set, name='patate douce')
]

View File

@ -1,5 +1,15 @@
from django.http import HttpResponse
from .models import TaMereLaPute
def index(request):
return HttpResponse("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA<br>ca marche enfin")
try:
a = TaMereLaPute.objects.get(id=1)
return HttpResponse(a.test)
except TaMereLaPute.DoesNotExist:
return HttpResponse("does not exist")
def set(request):
a = TaMereLaPute(test="coucou les musulmans moi je mange la glace")
a.save()
return HttpResponse("done")

View File

@ -1,5 +1,5 @@
until pg_isready -h "$DB_HOST"; do sleep 0.5 ;echo "waiting for database";done
cd /var/www/djangoserver/server
python3 manage.py makemigrations
python3 manage.py makemigrations server
python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8000