ajout fichiers manquant
This commit is contained in:
39
test.py
Normal file
39
test.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import django
|
||||
from datetime import date
|
||||
from django.conf import settings
|
||||
from pathlib import Path
|
||||
BASE_DIR = Path(__file__).resolve()
|
||||
print(BASE_DIR)
|
||||
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'collabs.apps.PollsConfig',
|
||||
]
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': './db.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
settings.configure(
|
||||
INSTALLED_APPS = INSTALLED_APPS,
|
||||
DATABASES = DATABASES,
|
||||
)
|
||||
django.setup()
|
||||
from django.apps import apps
|
||||
from django.apps import AppConfig
|
||||
|
||||
from polls.apps import PollsConfig
|
||||
from polls.models import *
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print(Question.objects.order_by('-pub_date')[:5])
|
||||
|
||||
new_question = Question(question_txt="test ?", pub_date=date.today() )
|
||||
new_question.save()
|
||||
print(Question.objects.order_by('-pub_date')[:5])
|
Reference in New Issue
Block a user