`
huangro
  • 浏览: 333524 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Installing Satchmo on Webfaction

阅读更多
link: http://brianmckinney.net/blog/2007/aug/22/installing-satchmo-webfaction/
Wednesday, August 22, 2007

For a project I am working on, I had to figure out a quality shopping cart app to use. I tried a couple mainstream solutions and then I found out about Satchmo, a Django-based shopping cart. This seemed like a perfect solution, it had all the power and easy configuration of Django built right in. However, I had some difficulties getting it up and running. Needless to say, I thought some notes on installation might be useful to someone who uses Webfaction and wants to try it out.

Obviously, any modifications you make to your account based on this tutorial, you are responsible for. I do not take responsiblity for any liability or downtime you incur as a result of this tutorial. This tutorial in intended to be carried out on a server that is not production, in case there is downtime or problems resulting from installing Satchmo. Follow at your your own risk!
Setup your account to run Satchmo

The first thing you'll need to do is make sure you have an environment conducive to running Satchmo on Webfaction. This tutorial assumes you are starting from scratch. Extra scratch. Go to your panel (http://panel.webfaction.com) and sign in to begin.
Setup django from the Webfaction control panel

   1. Mouse over "Domains/websites" and select "Applications" from the menu
   2. Click on the "Add New" icon (icon just below the options heading, with the green plus sign)
   3. In the Name field, type "django_apps"
   4. In the App Type field, select "Django (0.96) with Python (2.5)"
   5. Click on the "Create" button to install Django
   6. A success page should appear once Django has been installed

Add a static area for media files

   1. Mouse over "Domains/websites" and select "Applications"
   2. Click on the "Add New" icon
   3. In the "Name" field, type a memorable name for your title for your media files (ex. somesite_media)
   4. In the dropdown for "App type", select "Static/CGI/PHP"
   5. Click on the"Create" button
   6. A success page should appear, once the media area has been created

Add a link to the admin media files

   1. Mouse over "Domains/websites" and select "Applications"
   2. Click on the "Add New" icon
   3. In the "Name" field, type "admin_media"
   4. In the dropdown for "App type", select "Symbolic link"
   5. In the "Extra info" field, type the absolute path to your admin media (/home/username/lib/python2.5/django/contrib/admin/media)
   6. Click on the "Create" button
   7. A success page should appear, once the admin media area has been created

Add a redirect application

Most modern websites serve the same content to both a www prefix and a non-www prefix domain name. When using Satchmo, you will likely want to utilize a single domain (like somesite.com) and redirect the www version or vice-versa. At first I was trying to support both www and non-www versions and it caused problems with user accounts and security certificates. Installing a redirect with webfaction is no problem, and is the correct way to handle this situation. Note: Versions of this tutorial before March 3, 2008 did not illustrate how to install this redirect.

   1. Mouse over "Domains/websites" and select "Applications"
   2. Click on the "Add New" icon
   3. In the "Name" field, type a memorable name for your title for your redirect (ex. redirect)
   4. In the dropdown for "App type", select "Static/CGI/PHP"
   5. Click on the "Create" button
   6. A success page should appear, once the redirect app has been created

Connect your domain to Webfaction

   1. Assuming you've already pointed your DNS at Webfaction, mouse over "Domains/websites" and select "Domains"
   2. Click on the "Add new" icon to add a new domain
   3. In the name field, type the name of the domain exactlly (ex: somesite.com)
   4. Click on the "Add new" icon to add a new prefix
   5. In the field that appears, type "www"
   6. Click the "Create" button
   7. You will get a success page that tells you your item has been created
   8. Visiting your domain should now result in a "Site not configured" message

Connect your website to the domain

   1. Mouse over "Domains/websites" and select "Websites"
   2. Click on the "Add new" icon to add a new website
   3. In the "Name" field, type the name of the site (ex: somesite)
   4. Do not check the box for Https
   5. In the "Subdomains" box, select the domain name you will want for the actual main site (ex: somesite.com OR www.somesite.com)
   6. Under the "Site Apps" area, click on the "Add new" icon
   7. In the "App" field, select "django_apps", then in the "URL path" field type "/"
   8. Again, under the "Site Apps" area, click on the "Add new" icon
   9. In the &"App" field, select the name of your media area. In the "URL path" field type "/media"
  10. Again, under the "Site Apps" area, click on the "Add new" icon
  11. In the "App" field, select the name of your admin media area. In the "URL path" field type "/admin_media"
  12. Click the "Create" button
  13. A success page should display, telling you your item has been created
  14. Mouse over "Domains/websites" and select "Websites"
  15. Click on the "Add new" icon to add a new website
  16. In the "Name" field, type the name of the site and add a "-secure" (ex: somesite-secure)
  17. This time, check the box for Https
  18. In the "Subdomains" box, select the same domain name as above
  19. Under the &"Site Apps" area, click on the "Add new" icon
  20. In the "App" field, select "django_apps", then in the "URL path" field type "/"
  21. Again, under the "Site Apps" area, click on the "Add new" icon
  22. In the "App" field, select the name of your media area, then in the "URL path" field type "/media"
  23. Again, under the "Site Apps" area, click on the "Add new" icon
  24. In the "App" field, select the name of your admin media area, then in the "URL path" field type "/admin_media"
  25. Click on the "Create" button
  26. You should get a success page, telling you your item has been created

Connect the redirect to the domain

   1. Mouse over "Domains/websites" and select "Websites"
   2. Click on the "Add new" icon to add a new website
   3. In the "Name" field, type a name for the redirect (ex: www-redirect)
   4. Do not check the box for Https
   5. In the "Subdomains" box, select the domain name you will want to be redirected to the actual site (ex: somesite.com OR www.somesite.com)
   6. Under the "Site Apps" area, click on the "Add new" icon
   7. In the "App" field, select "redirect", then in the "URL path" field type "/"
   8. Click the "Create" button
   9. A success page should display, telling you your item has been created
  10. Mouse over "Domains/websites" and select "Websites"
  11. Click on the "Add new" icon to add a new website
  12. In the "Name" field, type the name for the redirect and add a "-secure" (ex: www-redirect-secure)
  13. This time, check the box for Https
  14. In the "Subdomains" box, select the domain name you will want to be redirected to the actual site (ex: somesite.com OR www.somesite.com)
  15. Under the "Site Apps" area, click on the "Add new" icon
  16. In the "App" field, select "redirect", then in the "URL path" field type "/"
  17. Click on the "Create" button
  18. You should get a success page, telling you your item has been created

Setup your Database

For this example we are going to use MySQL, but you can obviously use postgresql if you want.

   1. Mouse over "Databases" and select "Create new database"
   2. Leave the "Machine" field as is
   3. In the "Type" field, select "MySQL"
   4. In the "Name&" field, type your account name_sa (ex: someaccount_sa) Webfaction requires that database names begin with the account name and are less then 16 characters long
   5. In the "Encoding" field, leave utf8
   6. Click on the "Create" button
   7. A success message will appear, and a default password will be displayed
   8. Make note of the name of the database, the username, and the password - located in the green text toward the top of the screen

Install and configure the Satchmo code

Now that you've setup your Webfaction environment to run Django, you should be able to visit your domain name and see the django success message. To run Satchmo, you'll need to download the satchmo code and configure it. Using a ssh client, signin to your Webfaction account to get started.
Rename your project

   1.

      Once you've signed in, cd into your webapps directory, there should be a django_apps directory, a media directory, and a admin media symbolic link (more if you have other applications installed)
   2.

      cd into the "django_apps" directory and rename the "myproject" directory to satchmoproject
   3.

      edit the apache2/conf/httpd.conf direcory and change:

      SetEnv DJANGO_SETTINGS_MODULE myproject.settings

      to

      SetEnv DJANGO_SETTINGS_MODULE satchmoproject.settings

Download the Satchmo code

   1.

      cd into your home directory
   2.

      make a new directory called packages
   3.

      cd into that directory and run this command if you want the newest (with the slight possiblity of bugs) code:

      svn co svn://satchmoproject.com/satchmo/trunk/ satchmo-source

      or this command if you want a guaranteed stable release:

      svn co svn://satchmoproject.com/satchmo/tags/0.6 satchmo-source

      *Note: .6 is the current stable version as of this writing. Visit the satchmo project website for the current version number*
   4.

      Copy the satchmo-source/satchmo directory into the "packages" directory
   5.

      cd back to your home directory and edit the .bash_profile file
   6.

      Under the line "# User specific environment and startup programs", add "export PYTHONPATH=$PYTHONPATH:$HOME/packages"
   7.

      Save the file and exit
   8.

      Run the command "source .bash_profile" to reload it
   9.

      Type "echo $PYTHONPATH" to verify that the "packages" directory has been added
  10.

      Edit the .bashrc file
  11.

      Under the line "## User specific aliases and functions", add "alias python=python2.5"
  12.

      Save the file and exit
  13.

      Run the command "source .bashrc" to reload it

Download the correct Django snapshot

This is a little tricky. Satchmo is very much on the bleeding edge of Django, when Django makes changes to its' code base, it often times will cause errors within Satchmo. The developers at Satchmo do a good job of keeping their versioning in line with updates to the Django code. The best approach is to get the newest code from Satchmo and Django and verify that it works. If you have major problems with incombatitbility, switch to this specific Django snapshot and keep with it until django gets a bit closer to 1.0 (backwards compatability). This step could significantly screw up other django apps you are running off of the same django installation. Proceed at your own risk.

   1.

      cd into your Python directory (/home/username/lib/python2.5/)
   2.

      run this command:

      svn co http://code.djangoproject.com/svn/django/trunk/ django-source

      or if you've had problems with the newest code, try this

      svn co -r 5947 http://code.djangoproject.com/svn/django/trunk/ django-source

   3.

      The new Django code should be downloaded into the "django-source" directory
   4.

      Copy "django-source/django" directory into the "python2.5" directory (replacing the old django files)
   5.

      Don't forget to restart your apache!

Configure the settings files

   1.

      Copy the "settings-customize.py", "local_settings-customize.py" and "load-data.py" from the "packages/satchmo/" directory over to the "satchmoproject" directory under "django_apps"
   2.

      cd into the satchmoproject directory
   3.

      Rename the settings-customize.py file to settings.py
   4.

      Edit the settings.py file and move down to the line that says:

      DJANGO_SETTINGS_MODULE = 'satchmo.settings'

      change to:

      DJANGO_SETTINGS_MODULE = 'settings'

      Next, find the line that says:

      DATABASE_ENGINE = ""

      change to:

      DATABASE_ENGINE = "mysql"

      Next, find the line that says:

      MEDIA_ROOT = os.path.join(DIRNAME, 'static/')

      Change this line to:

      MEDIA_ROOT = "/home/username/webapps/*name of media directory*"

      Next, find the line that says:

      MEDIA_URL= "/static/"

      Change this line to:

      MEDIA_URL="/media/"

      Next, find the line that says:

      ADMIN_MEDIA_PREFIX ="/media/"

      Change this line to:

      ADMIN_MEDIA_PREFIX = "/admin_media/"

      Finally, find the line under "TEMPLATE_DIRS" that says:

      os.path.join(DIRNAME, "templates"),

      modify to be:

      "/home/username/packages/satchmo/templates/"

   5.

      Save the file and quit
   6.

      Rename the local_settings-customize.py file to local-settings.py
   7.

      Edit the local_settings.py file
   8.

      Find the database information area, which should look like this:

      DATABASE_NAME = ""
      DATABASE_PASSWORD = ""
      DATABASE_USER = ""
      SECRET_KEY = ""

      Enter the database information you made note of and if you would like, add a security key.
   9.

      Find the line that says:

      CHECKOUT_SSL=False

      and change to:

      CHECKOUT_SSL=True

  10.

      Save the file and quit
  11.

      Restart apache

Load the sample data

   1. Still within the satchmoproject directory, type the command: python load_data.py
   2. A bunch of data should get created for you to play around with
   3. Restart apache

Link up the media files

   1. cd into your media directory ("/home/username/webapps/media")
   2. Copy the image, css, and javascript folders from /home/username/packages/satchmo/static/ to the media directory.

Configure the redirect

   1.

      create a file "/home/username/webapps/redirect/.htaccess" with the following content:

      RewriteEngine on
      RewriteCond %{HTTP_HOST} domain.com
      RewriteRule ^(.*) http://www.domain.com/$1 [R]

      Note: This will redirect 'domain.com' to 'www.domain.com', you may choose to do the opposite, and if so, simply switch these two in the above code.

All done!

Go to your website and view satchmo in all of its' glory. OK, seriously, now you should be able to alter your images, css, etc. and get a good online store going

Thanks for checking out the article, happy selling.
分享到:
评论

相关推荐

    Microsoft Windows 2000 Scripting Guide - Installing Software on a Remote Computer

    Microsoft Windows 2000 Scripting Guide - Installing Software on a Remote Computer

    Installing RAC on AIX

    本篇将基于提供的文档摘要,深入解析安装Oracle RAC on AIX的关键步骤与注意事项,为读者提供一份详尽的操作指南。 ### 安装准备阶段 #### 1. 下载并解压安装介质 首先,需要从Oracle官方网站的edelivery服务下载...

    \Installing RAC on AIX 001.pdf

    根据提供的文档信息,本文将详细解析安装 Oracle RAC (Real Application Clusters) 在 AIX 操作系统上的步骤、注意事项及关键技术点。 ### 安装前准备 #### 下载安装介质与补丁集 ... - 示例文件包括:`B24442-01_1...

    Installing MIUI on Meizu MX2

    在IT领域,将一款设备刷入不同的操作系统或定制ROM是一种常见的技术操作,它允许用户根据个人喜好和需求自定义手机的界面与功能。本篇内容将深入解析如何在魅族MX2上安装MIUI系统,这是一项对于Android发烧友而言极...

    installing samba on ubuntu

    面是我在Ubuntu6.06 LTS 下源码编译安装samba主要安装过程,本人第一次用Ubuntu,刚装上去时候,没有gcc编译环境。郁闷了半天。找出这一过程发了不少的时间。可能还有些不妥,不过我经过这样的安装达到了向windows共享...

    Installing Your Driver on Windows Millennium

    Installing Your Driver on Windows Millennium INF File Guide

    MySQL V5.5帮助文档

    2.4.1. General Notes on Installing MySQL on Mac OS X 2.4.2. Installing MySQL on Mac OS X Using Native Packages 2.4.3. Installing the MySQL Startup Item 2.4.4. Installing and Using the MySQL Preference...

    anaconda安装 - Installing Anaconda on Ubuntu

    ### 安装Anaconda在Ubuntu上的详细步骤及关键知识点 #### 一、Anaconda简介 Anaconda是一款非常受欢迎的数据科学平台,它集成了Python或R语言环境中的许多库和工具,便于用户进行数据处理、科学计算、机器学习等...

    Installing Activ Test on Your PC

    ### 安装Activ Test软件至个人电脑的知识点详解 #### 一、背景介绍 随着信息技术的发展,越来越多的专业技能认证考试采用计算机化的方式进行。其中,ECDL(欧洲计算机驾驶执照)作为一项广泛认可的计算机操作技能...

    Requirements For Installing Oracle10gR2 On RHEL 5&OEL 5 (x86_64)

    ### 安装Oracle 10g R2在RHEL 5 & OEL 5 (x86_64)上的需求 #### 概述 本文档详细介绍了在Red Hat Enterprise Linux(RHEL)5和Oracle Enterprise Linux(OEL)5(x86_64架构)上安装Oracle 10g Release 2数据库的...

    OpenShift_Container_Platform-4.4-Installing_on_bare_metal-zh-CN.pdf

    第 1 章 在在裸裸机机上上安安装装 1.1. 在裸机上安装集群 1.2. 使用网络自定义在裸机上安装集群 1.3. 在受限网络中的裸机上安装集群

    Installing Configuring Alfresco ECM 3.1

    - **Installing the Alfresco Tomcat bundle on Linux**:对于 Linux 平台,同样提供了仅安装 Alfresco 和 Tomcat 的捆绑包的方法。 - **Installing Alfresco on Mac (full installation)**:Mac 用户的完整安装指南...

    installing oracle9i on redhat linux.rar

    从压缩包文件`Installing Oracle9i on RedHat Linux 7_2, 7_3, 8_0, 9, AS 2_1, 3_0 (Red Hat Enterprise Advanced Server 3 - RHEL AS 3) (Oracle database installation, install Oracle software).htm`中,我们...

    数据分析视频——R Programming.rar

    1 - 1 - Installing R on Windows.mp4 1 - 1 - Installing R on Windows_2.mp4 1 - 2 - Installing R on a Mac.mp4 1 - 3 - Installing R Studio (Mac).mp4 1 - 4 - Writing Code _ Setting Your Working Directory ...

    Installing STLinux on Ubuntu

    ### 安装STLinux在Ubuntu上的关键步骤与挑战 #### 概览 本文将深入探讨在Ubuntu上安装STLinux的全过程,重点解析由于包管理系统的差异而带来的挑战及其解决方案。对于那些希望在Ubuntu环境中利用STLinux强大功能的...

    Installing Oracle Database 11g on Linux

    在本文中,我们将深入探讨如何在Linux环境下安装Oracle Database 11g,这是一个重要的数据库管理系统,广泛用于企业级数据存储和处理。Oracle 11g提供了高性能、高可用性和安全性,使其成为许多组织的核心数据库解决...

    Installing Oracle 10G On Linux

    在本文中,我们将深入探讨如何在Linux环境下安装Oracle 10G数据库系统。Oracle 10G是一款功能强大的关系型数据库管理系统,广泛应用于企业级的数据存储和管理。Linux作为开源且稳定的操作系统,是部署Oracle数据库的...

    Installing Oracle 9i on RedHat Linux.rar

    在IT行业中,数据库管理系统是至关重要的,而Oracle数据库系统作为其中的佼佼者,被广泛应用于企业级的数据存储和管理。本教程将详述如何在Red Hat Linux操作系统上安装Oracle 9i,这对于那些需要在Linux环境下搭建...

Global site tag (gtag.js) - Google Analytics