在xampp中部署django rest时出现问题

时间:2019-02-14 21:03:44

标签: angular apache django-rest-framework xampp

我在客户端方面遇到一个罕见的问题,我正在使用angular 5作为客户端的一部分。 我已经在Apache中进行了所有更改,以运行Django,当我连接到服务器时,它在我的PC和手机上都能正常工作。 当向服务器发出请求时,它只能在服务器所在的我的PC和手机上运行。 enter image description here

这就是证明,这里的应用程序做得很好。 但是当我尝试访问另一台PC的服务器时,请求是针对旧地址的,即Django的 enter image description here

这是Apache的配置。

<IfModule wsgi_module>

 WSGIPythonPath C:\xampp\htdocs\tutorial
 <VirtualHost *:8081>

 Alias /static "C:\xampp\htdocs\tutorial\static"
 <Location "/media">
   SetHandler None
 </Location>

<LocationMatch "\.(jpg|gif|png|js|css)$">
  SetHandler None
</LocationMatch>

<Directory C:\xampp\htdocs\tutorial\static>
    Require all granted
</Directory>

<Directory C:\xampp\htdocs\tutorial >
   <Files wsgi.py>
       Require all granted
   </Files>
</Directory> 


  WSGIScriptAlias / C:\xampp\htdocs\tutorial\tutorial\wsgi.py

 </VirtualHost>


 </IfModule>

在部署客户端之前,我更改了服务的网址。

 URLCategorias : string = 'http://10.0.0.16:8081/api/categorias/';

是唯一使用该服务的地方

这是ES mi配置主机。

DEBUG = False

ALLOWED_HOSTS = ['10.0.0.16', 'localhost']

我不知道问题出在哪里,为什么在调用服务器时,它指向另一个地方。

0 个答案:

没有答案
相关问题