Création de table dans mysql (sur nas synology) non prise en compte
Bonjour,
Je commence à apprendre Django.
Je travail sur Ubuntu et ma base de donnée MySQL est sur mon NAS.
Dans mon projet, la base de données est correctement référencée car lorsque je lance la commande "python3 manage.py syncdb", les tables suivantes sont bien crées :
Code:
1 2 3 4 5 6 7 8 9
| Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session |
En revanche, les tables paramétrées dans le fichier models.py du répertoire backoffice ne sont pas créées.
Le répertoire a bien été rajouté au fichier settings.py
Code:
1 2 3 4 5 6 7 8 9 10
| # Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'backoffice'
) |
Contenu du fichier models.py du répertoire backoffice
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| from django.db import models
class Product(models.Model):
name = models.CharField(max_length=100)
code = models.IntegerField()
def __unicode__(self):
return "{0} [{1}]".format(self.name, self.code)
class ProductItem(models.Model):
color = models.CharField(max_length=100)
product = models.ForeignKey('Product')
code = models.IntegerField()
def __unicode__(self):
return "{0} {{1}} [{2}]".format(self.product.name, self.color, self.code) |
Quelqu'un a t il une idée du problème?
Par avance, je vous en remercie
Cordialement
G.THIRION