Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot syncdb “DatabaseError: no such table: django_site”

I've already asked this question once but didn't get an answer, I've read every single example of this error occurring i can find on the Internet so I'm going to try here again with more information.

What I am attempting: The cloning of a remote repo that I will then run live on my dev machine for development purposes.

The problem I am having: After cloning my repo off the webserver, using pip requirements.txt to install dependencies into my virtualenv i attempt to syncdb to build the db and allow me to run the server with runserver but when I attempt to do this i get the error "DatabaseError: no such table: django_site" output.

What I've tried: Commenting out django-contrib-sites from my installed_apps. Manually installing django_sites using pip with and without --ignore-installed, pip says that "Successfully installed django-sites django" but still get the error. I have tried to "migrate" and "migrate --all" but I get the same error. I have also verified that the db db.sqlite3 is the db specified in the settings.py and is in the correct location.

installed_apps -

INSTALLED_APPS = (
    'south',
    'django.contrib.flatpages',
    'django.contrib.comments',
    'django.contrib.markup',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.sitemaps',

)

A number of these are homebrewed applications from the previous dev.

Lines in .bashrc

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/projects
source /etc/bash_completion.d/virtualenvwrapper

The last line is because I am using Ubuntu on this dev machine, not 100% sure about that but I don't get any errors when starting bash.

Deploy Folder Not sure what this is, it has my requirements.txt and some other files: - httpd.conf - nowww.htaccess - plural.htaccess - requirements.txt - ssl.htaccess - wsgi.py

Process I am using

create virtualenv with mkvirtualenv envname

pip install django

git ssh clone from remote to local folder

pip install -r requirements.txt from repo

./manage.py syncdb

DatabaseError: no such table: django_site

I really need to figure this out as it prevents me from deploying on my dev server at home and doing remote work. If anyone can help please do, i promise to detail an answer and even build a tutorial page somewhere if it turns out to be a complex solution.

like image 345
leotemp Avatar asked Oct 21 '22 00:10

leotemp


1 Answers

I also got affected by this issue.

@tuxcanfly what you're saying is true, but for some reason the Site.objects.get_current().name expression gets evaluated even though the BLOG_NAME is set in the settings.py.

I've posted a ticket (and a patch) to GitHub for this issue: https://github.com/pigmonkey/django-vellum/issues/3

Using a try/catch rather than gettattr fixes it: https://github.com/AndreMiras/django-vellum/commit/9c242e16dc62c218e075554c5f5c5bc590df8265

like image 101
Andre Miras Avatar answered Oct 30 '22 03:10

Andre Miras