无法在本地IIS中发布/部署Django / Python站点(通过Visual Studio发布)

时间:2019-07-11 18:37:19

标签: python django visual-studio iis

我无法从Visual Studio(2019)将我的DjangoWebProject部署到本地IIS。

1) This is for Windows 10 environment.
2) Used stack: Python/Django/MongoDB/Javascript/D3
3) IIS works and successfully shows the default IIS site (tried from localhost and another machine)
4) Everything works great! I could successfully code/build the site and tested everything is working in debug mode (from VS) - e.g. it opens up http://localhost:<portnumber> in Chrome/EDge and the whole website works perfectly with all the form submission etc. etc.
3) Now I wanted to create the internal site published so other users can access and I tried Publish option...

WebpublishMethod: MSDeploy
Server Name: <my machine name>
Site name: Default Web Site
Destination URL: <my machine name>.corp.<my company>.com
Validate Connection : Successful

其他conf详细信息:

ExcludeAppData: False
SkipExtraFileOnServer: True
MSDeployPublishMethod: InProc
EnableMSDeploybackup: True

它被发布并在C:\ inetpub \ wwwroot \ app位置创建所有文件夹结构以及所有内容(包括所需的资源文件等),并且该文件夹结构与代码的Visual Studio文件夹结构一致-它显示所有文件,例如

__init__.py
forms.py
models.py
tests.py
views.py

加上所有必需的javascript和d3代码以及所有内容。

但是问题: 当我转到网站http://my-server-name.corp.my-company.com时,它没有显示该网站...

如果我导航到正确的位置并专门加载index.html-它不运行python或django引擎,因此它在浏览器中显示如下...

Chrome Browser: http://<my server name>.corp.<my company>.com
------------------------------------------------------
{% extends "app/layout.html" %} {% block content %}

Please enter the date range
{% csrf_token %}
{{form.fromDate.label_tag}} {{form.fromDate}}   {{form.toDate.label_tag}}   {{form.toDate}} {{form.guid}}   {{form.topcat}} 
{% if ratingResult %}
BarGraph Showing Rating Count Distribution
Table Showing Rating Count Distribution
{% for cat in ratingResult %} {% endfor %}
Rating  Count
Rating {{cat.overall_rating}}   {{cat.count}}
{% endif %}
{% endblock %}

很显然,该部署无法正常工作-它只是复制了文件。如何通过VS为Django / Python进行适当的部署?

预先感谢所有帮助。真的很感激。

0 个答案:

没有答案