推荐学习书目
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
wayz17
V2EX  ›  Python

用 Django 分别制作 pc 端和手机端的问题

  •  
  •   wayz17 · Sep 15, 2022 · 2312 views
    This topic created in 1361 days ago, the information mentioned may be changed or developed.
    最近想用 django ,边学边做一个网站,大致想法如下:

    项目里有 3 个 app ,
    app1 做网站后台,用域名 adm.domain-a.com 访问;
    app2 做电脑端,用域名 pc.domain-b.com 访问;
    app3 做手机端,用域名 sj.domain-b.com 访问;

    关于为什么前台和后台要用 2 个域名,因为要规避一些备案的问题。

    本人 py 新手,dj 新新手,大佬们勿笑。想问下我的想法是否可行?有没有其他更好的方法?

    拜谢!
    5 replies    2022-09-20 22:42:44 +08:00
    hellojay
        1
    hellojay  
       Sep 15, 2022
    这怎么会不可行呢,都是最简单的逻辑

    看起来这里面只要 domain-b 备案就可以了,做后台或者 api 没必要备案(我的理解)。
    wayz17
        2
    wayz17  
    OP
       Sep 15, 2022
    @hellojay
    比如电脑端的 url pc.domain-b.com/news/,手机端也要有个对应的 url sj.domain-b.com/news/;
    请问在 django 或 nginx 中,要怎么配置呢?
    hellojay
        3
    hellojay  
       Sep 15, 2022
    Django https://github.com/jazzband/django-hosts

    nginx 的配置方法很多,自行搜索一下
    chunhai
        4
    chunhai  
       Sep 19, 2022
    @wayz17 这个在后端检测然后判断然后跳转不行吗
    huangzhiyia
        5
    huangzhiyia  
       Sep 20, 2022 via Android
    前后端分离不就好了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2272 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 16:10 · PVG 00:10 · LAX 09:10 · JFK 12:10
    ♥ Do have faith in what you're doing.