我已经将Django项目部署到Railway.app中。我已经安装了铁路CLI,但不知道如何在它的CLI中运行python manage.py makemigrations等等,以使Django运行。
我的笔记本电脑正在运行Windows 10家庭。
是吗?
最新消息。答案得出的一些结果如下:
在settings.py中使用铁路的DB。在这种情况下,您不需要通过铁路CLI运行CLI命令,您可以使用本地命令,这将影响铁路的DB。
railway loginrailway link your_railway's_project_Idrailway status检查您是否在正确的项目中。railway run python manage.py createsuperuserrailway run python manage.py collectstatic make migrations migrate仍然不能在远程服务器上运行。
在Procfile中,我使用了代码:
web: python manage.py migrate && gunicorn project_name.wsgi发布于 2022-10-12 09:08:32
您可以通过使用railway run (command to be executed)来做到这一点。
例如,要创建超级用户,请使用railway run python manage.py createsuperuser
查看这篇文章
PS:确保您在与生产目录相同的目录中,因为它将在本地和生产环境中运行。
https://stackoverflow.com/questions/73843151
复制相似问题