关于django+vue工程部署到服务器上遇到的问题

一、前台有错误,前台请求后台接收不到

由于之前一直是在本地运行调试网站,前台请求后台都是http://localhost:8000/api/这样类似的,也一直没有问题,等到部署到服务器上时就卡主了,后来发现得把localhost换成当前ip,貌似可以用window.location.host来获取主机ip

二、前台正确的情况下,网站后台接收不到请求

一般是服务器没运行起来,但我可能比较特别,我一直使用python3 manage.py runserver 127.0.0.1:8000 在服务器上启动后台,然后根本接收不到请求,百度了半天,一个个解决方案去试,后来发现应该用python3 manage.py runserver 0.0.0.0:8000,这个127.0.0.1,和0.0.0.0广播地址有点搞不明白为什么,之后有时间再来百度理解一下,为什么

三、前台axios请求等待返回值后再执行

前面加个await就可以了,这次找bug感觉对前后台请求更为了解了,下次碰到前台发请求后台无响应net refused这种,在服务器上估计就是地址错了,或者服务器没有运行对地址,django如果接受到了get和post请求一定会显示在控制台上,但是如果换成java,下次查查有没有日志显示get和post请求历史日志

“关于django+vue工程部署到服务器上遇到的问题”的106个回复

  1. Discordance between changes in bone mineral density measured at different skeletal sites in perimenopausal women implications for assessment of bone loss and response to therapy The Danish Osteoporosis Prevention Study is azithromycin a penicillin The presence of a unilateral nipple discharge, or the presence of blood in nipple discharge should be evaluated by referring the patient to a breast specialist

  2. An interesting discussion is worth comment. I think that you should write more on this topic, it might not be a taboo subject but generally people are not enough to speak on such topics. To the next. Cheers

  3. My coder is trying to convince me to move to .net
    from PHP. I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using WordPress on a number of websites for about a year and
    am nervous about switching to another platform. I have heard great things about blogengine.net.
    Is there a way I can import all my wordpress content into it?
    Any kind of help would be greatly appreciated!

  4. When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get four
    emails with the same comment. Is there any way you can remove me from that service?
    Bless you!

  5. Wonderful blog you have here but I was curious if you knew of any discussion boards that cover the same topics
    discussed here? I’d really like to be a part of group where I
    can get comments from other experienced people that share the same interest.
    If you have any suggestions, please let me know. Many thanks!

  6. Magnificent goods from you, man. I have understand your stuff
    previous to and you’re just too great. I actually like what
    you’ve acquired here, certainly like what you’re saying and the way
    in which you say it. You make it enjoyable and you still take care of to keep
    it sensible. I cant wait to read much more from you. This is actually a great website.

  7. Please let me know if you’re looking for a
    article author for your blog. You have some really great posts and I feel I would be a good asset.
    If you ever want to take some of the load off, I’d absolutely love to write some articles for your blog in exchange for a link back to mine.
    Please shoot me an e-mail if interested. Regards!

  8. Не стоит пренебрегать таким фактом как забывание первых лет нашей жизни.
    Удивительно, что такие сложные эмоции и столь интенсивное интеллектуальное развитие, характерное
    для этих лет, не остаются обыкновенно в памяти уже повзрослевшего человека.
    Хотя вероятней всего, что эти детские
    впечатления и способны дать возможность разгадать причину возникновения многих невротических симптомов.
    5 способов вернуть интерес к работе и увлечениям

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注