django_settings_module error, unable to configure the server with the proper settings variable

main
Damon Del Priore 2020-11-16 14:10:54 -05:00
parent bad52b878b
commit 99d5406a47
6 changed files with 37 additions and 29 deletions

View File

@ -3,32 +3,19 @@ from django.db import models
from django.utils import timezone as tz
import sys
'''
def smart_truncate(content, length=100, suffix='...'):
if len(content) <= length:
return content
else:
return ' '.join(content[:length+1].split(' ')[0:-1]) + suffix
'''
class Author(models.Model):
name = models.CharField(max_length=255, default="", null=True, blank=True)
role = models.CharField(max_length=255, default="", null=True, blank=True)
aliases = models.CharField(max_length=255, default="", null=True, blank=True)
birth_year = models.IntegerField(null=True)
death_year = models.IntegerField(null=True)
wikipedia_url = models.URLField(max_length=500)
num_downloads = models.IntegerField(default=0)
release_date = models.IntegerField(null=True)
class Bookshelf(models.Model):
bookshelf_id = models.IntegerField()
bookshelf_name = models.CharField(max_length=255, null=False)
release_date = models.IntegerField(null=True)
num_downloads = models.IntegerField(default=0)
release_date = models.IntegerField(null=True)
class Meta:
db_table = "bookshelves"
'''
class Book(models.Model):
book_id = models.IntegerField()
repo_name = models.CharField(max_length=255, null=True, blank=True)
@ -45,8 +32,23 @@ class Book(models.Model):
updated = models.DateTimeField(auto_now_add=True, null=True)
yaml = models.TextField(null=True, default="")
class Author(models.Model):
name = models.CharField(max_length=255, default="", null=True, blank=True)
role = models.CharField(max_length=255, default="", null=True, blank=True)
aliases = models.CharField(max_length=255, default="", null=True, blank=True)
birth_year = models.IntegerField(null=True)
death_year = models.IntegerField(null=True)
wikipedia_url = models.URLField(max_length=500)
num_downloads = models.IntegerField(default=0)
release_date = models.IntegerField(null=True)
def smart_truncate(content, length=100, suffix='...'):
if len(content) <= length:
return content
else:
return ' '.join(content[:length+1].split(' ')[0:-1]) + suffix
'''
class Cover(models.Model):
book = models.ForeignKey(Book, on_delete=models.CASCADE, db_index=True)
file = models.FileField(upload_to="bookcovers/", null=True, blank=True)

View File

@ -33,7 +33,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'zgwvzeb!oca99v&c(=lljl)y_&^33dwoqs@%)arujer_#x(#gn'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
ALLOWED_HOSTS = [
'localhost'
@ -81,7 +81,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'bookshelf_management.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
@ -96,6 +95,8 @@ DATABASES = {
}
}
# sys.path.insert(100, '/mnt/c/users/damon/desktop/bookshelf-management/bookshelf_management/bookshelf_management/settings.py')
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators

View File

@ -1,12 +1,20 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
import bookshelf_management.settings.py
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookshelf_management.settings')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
'''
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
@ -15,8 +23,4 @@ def main():
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
'''

View File

@ -74,3 +74,4 @@ fi
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
hash -r
fi