django部署的问题

发布于 2024-09-10 22:06:53 字数 210 浏览 1 评论 0原文

我试图部署我的 django,但我总是遇到以下错误之一:(它们在我刷新页面时交替出现)

  • 模型页面已被注册(来自 feincms,但我在我的计算机上没有得到这个)

  • 无法打开数据库文件(数据库是sqlite3,并且在服务器上使用syncdb成功创建)

关于可能出现的问题有什么想法吗?

Im trying to deploy my django and I always get one of these erros: (they alternate as I refresh the page)

  • The model Page has already been registered ( its from feincms, but i dont get this on my computer )

  • unable to open database file (the database is sqlite3 and was successfully created with syncdb on the server )

Any ideas on what might be the problem ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

因为看清所以看轻 2024-09-17 22:06:53

第一个可能是因为在本地计算机上,您将 Django 作为 CGI 或其他“新请求 - 不同进程”方式运行。因此,如果您在每个请求中注册页面模型,那么它是有效的,因为您只有一个请求。但是在网络服务器上,您的应用程序以 FCGI 或类似的其他方式加载,因此只有第一个请求可以得到很好的服务(当发送第二个请求时,您的应用程序会尝试再次注册页面模型)。

第二个可能是因为您有数据库文件的相对路径。因此,如果您输入

./manage syncdb

项目目录“/my/project/dir”。 Django 在“/my/projec/dir/mydb.sqlite”中搜索文件。

但是如果你在网络服务器中运行它,你有不同的路径“/some/http/server/path”,所以你的程序会很混乱。

First one is probably because on your local computer you run Django as CGI, or some other "new request - different process" way. So if you registering Page model in every request, it's works because you have single request. But on web server your app is loaded as FCGI or some other way like this, so only first request can be served well (when second request is send, your app tries to register Page model again).

Second one is probably because you have relative path to db file. So if you type

./manage syncdb

in your project dir '/my/project/dir'. Django searches for file in '/my/projec/dir/mydb.sqlite'.

But if you run it in web server, you have different path '/some/http/server/path', so your program is confused.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文