8

I'm a front-end dev struggling along with Django. I have the basics pretty much down but I've hit at wall at the following point.

I have a site running locally and also on a dev machine. Locally I've added an extra class model to an already existing app, registered it in the relevant admin.py and checked it in the settings. Locally the new class and relevant fields appear in admin but when I move this all to dev they're not appearing. The app is called 'publish'.

My method was as follows:

  1. Created the new class in the publish > models.py file:
    class Whitepaper(models.Model):
        title = models.CharField(max_length=200)
        slug = models.SlugField(max_length=100, blank=True)
        pub_date = models.DateField('date published')
        section = models.ForeignKey('Section', related_name='whitepapers', blank=True, null=True)
        description = models.CharField(max_length=1000)
        docfile = models.FileField(upload_to="whitepapers/%Y/%m/%d", null=True, blank=True)

  1. Updated and migrated the model with South using:
python manage.py schemamigration publish --auto

and

python manage.py migrate publish
  1. Registered the class in the admin.py file:
    from models import Section, Tag, Post, Whitepaper
    from django.contrib import admin
    from django import forms

    admin.site.register(Whitepaper)

The app is listed in the settings.py file:

    INSTALLED_APPS = (
        ...,
        ...,
        'publish',
        ...,

)

As this is running on a dev server that's hosting a few other testing areas, restarting the whole thing is out of the question so I've been 'touching' the .wsgi file.

On my local version this got the model and fields showing up in the admin but on the dev server they are nowhere to be seen.

What am I missing?

Thanks ye brainy ones.

4

2 回答 2

8

我解决了这个问题。原来我用来进入管理员的登录名没有超级用户权限。所以我做了一个新的:

python manage.py createsuperuser

使用新的用户名和密码登录后,我可以看到我所有的新闪亮表!

于 2013-08-16T07:47:53.273 回答
0

您确定触摸.wsgi文件会重新启动您的应用程序吗?

好像没有。

确保应用程序已重新启动。找到触摸.wsgi文件的证据可能会重新启动应用程序。

由于您没有提供有关开发服务器如何运行应用程序的任何见解,因此我们将无法为您提供任何进一步的帮助。

于 2013-07-17T12:50:51.723 回答