如何将本地django制作的网站移动到另一台机器? [英] How to move a local django made site into another machine?

查看:145
本文介绍了如何将本地django制作的网站移动到另一台机器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经努力寻找我的查询的解决方案,但没有运气。我在本地机器上做了一个使用django的网站。现在我想在另一台机器上安装相同的django制作的网站。 MySQL是我正在使用的数据库。如何将本地django制作的网站移动到另一台机器?如果这个问题已经被讨论了,我的道歉。

I have tried hard searching for the solution to my query but with no luck. I have made a website using django in my local machine. Now i want to install the same django made website in another machine. MySQL is the database i am using. How do i move the local django made website into another machine? If this question has been already put under discussion, my apologies.

提前感谢

推荐答案

要在不同的机器上设置相同的Django站点,您只需复制代码即可。当您尝试运行它时,如果没有正确设置任何可以逐个解决的问题,您将收到错误。您可能会遇到的一些错误是:

To set up the same Django site on a different machine, you can just copy the code across. When you try and run it, you'll get errors if anything isn't set up correctly which you can resolve one by one. A few errors you are likely to get are:


  1. 确保Python安装在新框上

  2. 确保安装Django和任何其他依赖关系

  3. 您需要安装MySQL并在新机器上设置数据库


    • 如果数据库的主机不是
    • > localhost 或 127.0.0.1 ,您将需要考虑在哪里放置新数据库

  1. Make sure Python is installed on the new box
  2. Make sure Django and any other dependencies are installed
  3. You'll need to install MySQL and set up a database on the new machine
    • the details for the database (name, user, password) will be in your project's settings.py file
    • if the database's host isn't localhost or 127.0.0.1, you will need to think about where to put the new database

所有这些步骤都应该重复您在旧机器上所做的工作。

All these steps should simply be repeating things you did on the old machine.

如果您有一台dev机器作为一个生产机器,您应该考虑自动化这一过程的大部分的部署解决方案。如果还没有将代码放入版本控制( GIT mercurial subversion )以便您可以从任一位置管理来源的更改。

If you have a 'dev' machine and a 'production' machine, you should consider deployment solutions that automate much of this process. You should also put the code into version control if it isn't already (GIT, mercurial, subversion) so that you can manage changes to the source from either location.

如果您希望在两台机器上都具有相同的 站点(因此,一个出现在另一个),你可能在谈论负载平衡。您需要设置另一台可以将请求委托给这两台机器的服务器,并将它们指向同一个数据库。

If you want to have the same site across both machines (so changes to one appear on the other) you are probably talking about 'load balancing'. You'll need to set up another server that can delegate requests to these two machines and point both at the same database.

祝你好运!

这篇关于如何将本地django制作的网站移动到另一台机器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆