WebFaction
Community site: login faq

I used startproject to create a project called 'ens'. I used startapp to create an app called 'blog' which has its own model.py and views.py.

I syncdb'd and the tables are created. There's a blog_tag and blog_article etc.

My views.py has for example:

from models import Tag, Node, Comment, UserProfile
def blogs(request):
    """Main blogs listing."""
    tags = Tag.objects.all()
    return render_to_response("blog/index.html", dict(tags=tags, user=request.user))

I do in fact, have a tag through admin panel. So everything is fine.

However, when I go to this view url, I get

"DatabaseError" 
relation "ens\_tag" does not exist
LINE 1: ...", "ens\_tag"."title", "ens\_tag"."description" FROM "ens\_tag"

Why is it looking for ens_tag, it should be blog_tag---how do you fix this???

I also tried:

from ens.models import Tag, Node, Comment, UserProfile

from ens.blog.models import Tag, Node, Comment, UserProfile

from blog.models import Tag, Node, Comment, UserProfile

No luck.

asked 27 Jul '12, 01:14

execute
726
accept rate: 0%

edited 27 Jul '12, 01:20


Try searching recursively for 'ens' or manually reading the model. What django looks for comes from the model, it could possibly be a typo.

grep --color=auto -n -R 'ens' ~
permanent link

answered 27 Jul '12, 17:46

johns
5.4k312
accept rate: 23%

edited 27 Jul '12, 17:46

I don't know how to read the model. I looked from PostgreSQL admin panel and can see there is a blog_tag blog_comment etc. However, it looks for ens_tag etc. so it looks for project name instead of app name that is in the database. This could be because I hadn't realized I needed an app in the first place and just put my model in ens folder before, but I moved it now syncdb should recreate the model for the app instead of project. And since no ens_ tables exist, then syncdb has done a good job, so why is django looking for old tables?

(28 Jul '12, 14:52) execute

Post the code in models.py or submit a support ticket and we can look directly.

(28 Jul '12, 17:54) johns
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×54
×7

question asked: 27 Jul '12, 01:14

question was seen: 1,859 times

last updated: 28 Jul '12, 17:54

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM