Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建blogpost失败 #8

Closed
nulitype opened this issue May 26, 2016 · 6 comments
Closed

创建blogpost失败 #8

nulitype opened this issue May 26, 2016 · 6 comments

Comments

@nulitype
Copy link

你好:
创建完 blogpost 之后,正确的做法是否是需要到 setting.py 里的 INSTALLED_APPS 添加 blogpost
然后再运行python manage.py makemigrationspython manage.py migrate 迁移。

@phodal
Copy link
Owner

phodal commented May 26, 2016

嗯,是的,我再更新一下文档

@phodal phodal closed this as completed in 4ef987c May 26, 2016
@StevenYuysy
Copy link

在 web 版跟着做一遍发现始终无法添加 model,还好这里给出了解决办法~ 求快更新

@phodal
Copy link
Owner

phodal commented Jun 28, 2016

@StevenYuysy 快更新是指?

@StevenYuysy
Copy link

我这里需要运行 python manage.py makemigrations之后才能继续进行下去,而 web 版只说了需要 python manage.py migrate ,如果我只运行那一句的话,就提示

Operations to perform:
  Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
  No migrations to apply.
  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

另外,如果我没有在 url.py 注释掉

#apiRouter = routers.DefaultRouter()
#apiRouter.register(r'blogpost', BlogpostSet)

urlpatterns = patterns('',
    (r'^$', 'blogpost.views.index'),
    url(r'^blog/(?P<slug>[^\.]+).html', 'blogpost.views.view_post', name='view_blog_post'),
    url(r'^admin/', include(admin.site.urls)))
#) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

运行python mange.py test的时候就会说 apiRouter 未定义,以及settings没有STATIC这个属性

@phodal phodal reopened this Jun 28, 2016
@phodal
Copy link
Owner

phodal commented Jun 28, 2016

@StevenYuysy 感觉应该是代码和编写顺序不一致~。你都这么清楚了,可以直接来个Pull Request。

@StevenYuysy
Copy link

小白一个,还不会 PR 呢。本来学前端的,最近看了你的书,想向你学习!!等我把你的这个教程吃透,还要请多指教了!

@phodal phodal closed this as completed in 58d046d Jun 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants