I got this following error while running django project "ProgrammingError at /admin/ Table 'django_session' doesn't exist".
This error you will get, when you're not migrated the django model.
import datetime
from django.db import models
import os
from django.db import models
def getFileName(request,filename):
now_time=datetime.datetime.now().strftime("%Y%m%d%H:%M:%S")
new_filename="%s%s"%(now_time,filename)
return os.path.join('uploads/', new_filename)
class Category(models.Model):
name=models.CharField(max_length=150,null=False,blank=False)
image=models.ImageField(upload_to=getFileName,null=True,blank=True)
description=models.TextField(max_length=500,null=False,blank=False)
status=models.BooleanField(default=False,help_text="0-Show,1-Hidden")
created_at=models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.name
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
pip install matplotlib