部署Django项目:文件夹/项目结构

时间:2021-03-31 20:23:30

My django project in eclipse has this project structure:

我在eclipse中的django项目有这个项目结构:

main-project-folder/

                 src/
                        main-app/
                                 app1/
                                 app2/
                                 settings.py
                                 manage.py
                                 urls.py
                                 __init__.py
                 media/
                 templates/

Can i deploy the project with this structure? In other words, is right way to put src and other folders (media, tempaltes, etc.) in the root folder of my server (where my domain is linked)?

我可以使用这种结构部署项目吗?换句话说,是将src和其他文件夹(媒体,tempaltes等)放在我服务器的根文件夹(我的域链接)的正确方法吗?

Like:

my-server-folder/

             src/
             media/
             ...

I imagine that in my-server-folder i should put the entry point of project, but in my project i haven't an entry point in main-project-folder, or does django automatically redirect to an entry point of src/main-app folder (i think that it doesn't because i don't find any options that say to django to do it)?

我想在my-server-folder中我应该把项目的入口点,但在我的项目中我没有在main-project-folder中的入口点,或者django自动重定向到src / main的入口点 - 应用程序文件夹(我认为它不是因为我没有找到任何说django做的选项)?

1 个解决方案

#1


1  

Sure. That's a fine directory structure.

当然。这是一个很好的目录结构。

Keep in mind your web server isn't going to know what to do with the Django project unless you tell it. If your web server is Apache (which it probably is if you don't know) look here for instructions to set it up to run the Django app:

请记住,除非您说明,否则您的Web服务器不会知道如何处理Django项目。如果您的Web服务器是Apache(如果您不知道可能是它),请在此处查看有关将其设置为运行Django应用程序的说明:

https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/

And here for WSGI:

这里是WSGI:

http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

Django apps aren't like PHP where you just upload them to the web server and they work.

Django应用程序不像PHP,只需将它们上传到Web服务器即可运行。

#1


1  

Sure. That's a fine directory structure.

当然。这是一个很好的目录结构。

Keep in mind your web server isn't going to know what to do with the Django project unless you tell it. If your web server is Apache (which it probably is if you don't know) look here for instructions to set it up to run the Django app:

请记住,除非您说明,否则您的Web服务器不会知道如何处理Django项目。如果您的Web服务器是Apache(如果您不知道可能是它),请在此处查看有关将其设置为运行Django应用程序的说明:

https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/

And here for WSGI:

这里是WSGI:

http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

Django apps aren't like PHP where you just upload them to the web server and they work.

Django应用程序不像PHP,只需将它们上传到Web服务器即可运行。