MagentoCommerce开发环境领域问题 [英] MagentoCommerce development environment domain issue

查看:89
本文介绍了MagentoCommerce开发环境领域问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事基于 MagentoCommerce 的电子商务.我使用3种环境:开发(在我的本地计算机上),暂存和生产(都在我的专用服务器上).

I am working on a ecommerce based on MagentoCommerce. I use 3 environments: dev (on my local machine), staging and production (both on my dedicated server).

问题是,当我想从本地切换到暂存时,我必须编辑主机文件,以将Magento使用的域指向服务器的IP.但是,这很耗时,我想知道其他的magento开发人员在从环境切换到另一个环境时使用什么策略来不必总是更改主机文件.另外,当我的电子商务投入生产时,我将不得不处理同一IP上的两个环境.

The problem is that when I want to switch from local to staging, I have to edit my hosts file to point the domain used by Magento to my server's IP. However, this is time consuming and I was wondering what other magento developers out there were using as a strategy to not always have to change the hosts file when switching from an environment to another. Plus, when my ecommerce goes into production, I'll have to deal with 2 environments on the same IP.

最好的情况是,如果Magento仅在一个文件中对域进行硬编码.这样,我可以在每个环境中保留不同的配置文件.是这样吗?否则,域名会被硬编码"在什么地方?

The best would be if Magento had the domain hardcoded in only one file. That way I could keep different config files in each environment. Is that the case ? Otherwise, what places are domains "hard coded" ?

推荐答案

我正在生产服务器和许多开发和测试域上运行Magento.

I'm running Magento on a Production server and a number of development and test domains.

该域未在任何文件中进行硬编码-该域全部在数据库中.

The domain isn't hardcoded in any file - the domain is all in the database.

在服务器之间移动时,必须更改安全基本URL和不安全基本URL.两者都存储在数据库中,并且可以在基于Web的管理屏幕中进行更改.将数据库从一台主机移到另一台主机时,我使用的脚本几乎没有做任何事情,但会更新这些值.这是您需要更新这些值的SQL:

You have to change the secure base url and the unsecure base url when you move from server to server. Both of these are stored in the database and can be changed in the web based administration screens. When moving the database from one host to another, I use a script that does little but update these values. Here's the SQL you need to update these values:

update core_config_data
set value='http://whatever.com/'
where path='web/unsecure/base_url';

update core_config_data
set value='https://whatever.com/'
where path='web/secure/base_url';

您可能还需要注意配置数据库连接的local.xml文件.我确定您要使用不同的数据库来使用不同的实例.在我的配置中,我将此文件置于源代码管理之外,并为每个实例仅配置了一次.

You may also want to pay attention to the local.xml file where the database connection is configured. I'm sure that you'll want to have the different instances using different databases. In my configuration, I leave this file out of source control, and configure it just once for each instance.

这篇关于MagentoCommerce开发环境领域问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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