PythonAnywhere Forums

no such table: buuv_contents

I already read the other topics on this very issue, but the solution mentioned there didn't solve the problem. Last thing I did was running

(venvB) 11:59 ~/biebuuf $ django-admin inspectdb

this resulted in the following:

django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings

But I don't no how to do this.

Where are you seeing the "no such table: buuv_contents" error? Is it in your website logs, or when you try to run a command from the command line? If the latter, which command?

For the error with django-admin, if the directory ~/biebuuf contains a manage.py file, then just run (making sure you're inside your virtualenv) this command to inspectdb:

python manage.py inspectdb

-- that will make sure that all of the DJANGO_SETTINGS_MODULE stuff is set properly.

Thank you, unfortunadly it didn't work. After uploading the site again I still get the error (website logs) and also this:

Error during template rendering

In template /home/codeComm/biebuuf/buuv/templates/buuv/base.html, error at line 8
no such table: buuv_contents
1   {% load static %}
2   
3   <!doctype html>
4   <html>
5       <head>
6           <meta charset="utf-8">
7           <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
8           <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width"/>
9   
10          <!--[if lt IE 9]>
11              <script="http://html5shiv.google.com/svn/trunk/html5.js"></script>
12          <![endif]-->

the website

[edit by admin: formatting]

What happens when you run

python manage.py inspectdb

...?

I get the following, but where do I find this file? It sais that I have to rearrarange it?

 (venvbf) 18:22 ~/biebuuf $ python manage.py inspectdb
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Make sure each ForeignKey has `on_delete` set to the desired behavior.
#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.

from __future__ import unicode_literals
from django.db import models

class AuthGroup(models.Model):
    id = models.IntegerField(primary_key=True)  # AutoField?
    name = models.CharField(unique=True, max_length=80)
    class Meta:
        managed = False
        db_table = 'auth_group'

class AuthGroupPermissions(models.Model):
    id = models.IntegerField(primary_key=True)  # AutoField?
    group = models.ForeignKey(AuthGroup, models.DO_NOTHING)
    permission = models.ForeignKey('AuthPermission', models.DO_NOTHING)
       class Meta:
        managed = False
        db_table = 'auth_user_user_permissions'
        unique_together = (('user', 'permission'),)

class DjangoAdminLog(models.Model):
    id = models.IntegerField(primary_key=True)  # AutoField?
    object_id = models.TextField(blank=True, null=True)
    object_repr = models.CharField(max_length=200)
    action_flag = models.PositiveSmallIntegerField()
    change_message = models.TextField()
    content_type = models.ForeignKey('DjangoContentType', models.DO_NOTHING, blank=True, null=True)
    user = models.ForeignKey(AuthUser, models.DO_NOTHING)
    action_time = models.DateTimeField()

    class Meta:
        managed = False
        db_table = 'django_admin_log'

class DjangoContentType(models.Model):
    id = models.IntegerField(primary_key=True)  # AutoField?
    app_label = models.CharField(max_length=100)
    model = models.CharField(max_length=100)
    class Meta:
        managed = False
        db_table = 'django_content_type'
        unique_together = (('app_label', 'model'),)

class DjangoMigrations(models.Model):
    id = models.IntegerField(primary_key=True)  # AutoField?
    app = models.CharField(max_length=255)
    name = models.CharField(max_length=255)
    applied = models.DateTimeField()
    class Meta:
        managed = False
        db_table = 'django_migrations'

class DjangoSession(models.Model):
    session_key = models.CharField(primary_key=True, max_length=40)
    session_data = models.TextField()
    expire_date = models.DateTimeField()
    class Meta:
        managed = False
        db_table = 'django_session'

[edit by admin: formatting]

OK, so what it's saying is that you have a database that only has the default Django admin tables installed. Have you run python manage.py migrate to set up your own database tables?

yes, I did

but it only loads the default Django admin tables...

What did it print out (if anything)?

the thing I showed yesterday, where you responded that it shows the default settings

This morning I made a new venv and deleted the other, as well as the database and installed every thing againg (django, pillow, creating superuser, run migrate) but same outcome...

Problem solved!!

Thanks for all your help

Ah, excellent! What was the solution?