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
wayz17
V2EX  ›  Python

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

  •  
  •   wayz17 · 2022-09-15 11:39:02 +08:00 · 1501 次点击
    这是一个创建于 582 天前的主题,其中的信息可能已经有所发展或是发生改变。
    最近想用 django ,边学边做一个网站,大致想法如下:

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

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

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

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

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

    nginx 的配置方法很多,自行搜索一下
    chunhai
        4
    chunhai  
       2022-09-19 19:32:07 +08:00
    @wayz17 这个在后端检测然后判断然后跳转不行吗
    zmaplex
        5
    zmaplex  
       2022-09-20 22:42:44 +08:00 via Android
    前后端分离不就好了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5297 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 03:41 · PVG 11:41 · LAX 20:41 · JFK 23:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.