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 from django.db import models
class TaMereLaPute(models.Model): 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' 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! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = True
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
@ -31,12 +31,12 @@ ALLOWED_HOSTS = ['*']
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'server',
] ]
MIDDLEWARE = [ MIDDLEWARE = [

View File

@ -2,21 +2,22 @@
URL configuration for server project. URL configuration for server project.
The `urlpatterns` list routes URLs to views. For more information please see: 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: Examples:
Function views Function views
1. Add an import: from my_app import views 1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home') 2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views Class-based views
1. Add an import: from other_app.views import Home 1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf Including another URLconf
1. Import the include() function: from django.urls import include, path 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.urls import path from django.urls import path
from . import views from . import views
urlpatterns = [ 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 django.http import HttpResponse
from .models import TaMereLaPute
def index(request): 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 until pg_isready -h "$DB_HOST"; do sleep 0.5 ;echo "waiting for database";done
cd /var/www/djangoserver/server cd /var/www/djangoserver/server
python3 manage.py makemigrations python3 manage.py makemigrations server
python3 manage.py migrate python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8000 python3 manage.py runserver 0.0.0.0:8000