Ask Your Question

add a new app to askbot - syncdb doesn't create model

asked 2013-11-14 13:27:58 -0600

SocialQA gravatar image

I have created a new app when I run python syncdb it get listed under synced module but when I go and take a look at the database tables have not been created. I have added the new app to installed_apps.

Here is how my model looks like:

from django.db import models from askbot.deps.django_authopenid.models import User

class MyUser(models.Model):
    auth_user = models.ForeignKey(User)
    my_username = models.CharField(max_length = 200)
    my_user_role = models.CharField(max_length = 200)

    class Meta:
        app_label = 'askbot'

How can I integrate this with syncdb and migration process. Regardless the migration I thought when you add it to installed_apps it should create the database. Am I wrong? or is there anything else that I should be doing?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-11-14 13:34:13 -0600

Evgeny gravatar image

That's because app askbot requires migrations. It will be better to make your own app with different name then syncdb will work.

If you add tables in the askbot app, then you will need to add a migration creating that table and in the future maintain your migrations within the askbot/migrations directory.

edit flag offensive delete link more


I have named my app as myuser thats the name of the app its in askbot/myuser, should I create a migration folder there and run migration? I created another app but that worked find in that app i didn't use app_label = 'askbot' may be thats the reason?

SocialQA gravatar imageSocialQA ( 2013-11-14 13:39:35 -0600 )edit

Try changing "applabel" parameter to something else, and it will be better to place your app in a separate directory at the same level as "askbot". You could even keep your app in a separate repository.

Evgeny gravatar imageEvgeny ( 2013-11-14 13:45:30 -0600 )edit

Interesting thing was as it is mysql database generate the table during syncdb but postgres doesnt. So I tried askbot_myapp, this way it generate and empty migration script. I want my table to by askbot_myuser how can I get that with migration. i do following: python schemamigration askbot.myapp --initial with app_label = askbot_myapp then it generates empty migration 0001 file.

SocialQA gravatar imageSocialQA ( 2013-11-14 18:25:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-11-14 13:27:58 -0600

Seen: 210 times

Last updated: Nov 14 '13