V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Sunxb
V2EX  ›  Python

前后端分离的项目部署

  •  
  •   Sunxb · 2018-08-27 13:58:33 +08:00 · 2332 次点击
    这是一个创建于 2040 天前的主题,其中的信息可能已经有所发展或是发生改变。

    自己写了点代码,接口用 djagno 写的,前端就是简单的 html+js+css, 接口已经部署到外网的服务器了,uwsgi+nginx,但是页面不会搞了,上网查了一些也没弄清楚,请教一下 v 站的大神们,指点一下

    5 条回复    2018-08-27 14:34:49 +08:00
    hasbug
        1
    hasbug  
       2018-08-27 14:02:46 +08:00
    前端页面就简单的 nignx 就行了。例如:
    ```base
    server {
    listen 80;
    server_name www.xxx.com;

    location / {
    root /data/home/www/demo;
    }

    location ~/(javascript|css|images){
    root /data/home/www/demo/;
    }

    }

    ```
    Yourshell
        2
    Yourshell  
       2018-08-27 14:08:20 +08:00 via iPhone
    你把前端页面按照静态文件部署就得了,用前端路由的话可能要配置后端服务器。
    Sunxb
        3
    Sunxb  
    OP
       2018-08-27 14:18:42 +08:00
    @hasbug listen 的端口跟 django 的一样吗 ? 还有那个 server_name 必须写域名。。不能用 ip 访问?
    bhaltair
        4
    bhaltair  
       2018-08-27 14:29:17 +08:00
    nginx 啊 实在不行推到 oss 上 绑定自定义域名就可以了
    Sunxb
        5
    Sunxb  
    OP
       2018-08-27 14:34:49 +08:00
    @Yourshell @bhaltair @hasbug 多谢几位了 ~ 稀里糊涂的弄好了 ~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1605 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 16:53 · PVG 00:53 · LAX 09:53 · JFK 12:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.