<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Custom eCommerce and CMS Websites &#124; Design Practica</title>
	<atom:link href="http://designpractica.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://designpractica.com</link>
	<description>Web Design and Development in Vancouver</description>
	<lastBuildDate>Tue, 17 Jul 2012 22:18:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Deploying Django Application on Apache2 and Ubuntu</title>
		<link>http://designpractica.com/blog/deploying-django-application-apache-ubuntu/</link>
		<comments>http://designpractica.com/blog/deploying-django-application-apache-ubuntu/#comments</comments>
		<pubDate>Tue, 17 Jul 2012 22:18:01 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=513</guid>
		<description><![CDATA[tl;dr: Deploy Django app to Ubuntu with Apache2 and mod_wsgi &#8212; Here&#8217;s the sources for the helper utility I wrote for this. Annoyed by tedious application deployment? Can&#8217;t remember the steps? Previous web developer did not leave notes on how he deployed stuff to production? Have no fear, here&#8217;s your detailed instructions. Web application deployment [...]]]></description>
				<content:encoded><![CDATA[<div class="right sidenote">tl;dr: Deploy Django app to Ubuntu with Apache2 and mod_wsgi &mdash; <a href="https://github.com/orlenko/django-apache-wsgi-util">Here&#8217;s the sources</a> for the helper utility I wrote for this.</div>
<p>Annoyed by tedious application deployment? Can&#8217;t remember the steps? Previous web developer did not leave notes on how he deployed stuff to production? Have no fear, here&#8217;s your detailed instructions.</p>
<p>Web application deployment is one of those tasks that are complex enough to take you half a day to do properly, and at the same time they are simple enough that when you finally figure out how to do it, you say, &#8220;Aha, so that&#8217;s how it&#8217;s done! I&#8217;m glad I know now!&#8221; And you happily forget about it, until some weeks or maybe months later you need to deploy another one, and you scratch the back of your head, and for the love of everything good, can&#8217;t remember why WSGI can&#8217;t import that %*!$^&#038; module or something like that.</p>
<p>Well, no more. Here&#8217;s the latest, freshest guide to deploying your app to Ubuntu 10.04 LTS, Apache2, mod_wsgi, Python 2.6 or 2.7, MySQL, and Django 1.4, which hopefully will still work in at least one or two future versions.</p>
<h2>Assumptions / Prerequisites</h2>
<p>We&#8217;ll assume that you have an Ubuntu server with Apache2 installed. And MySQL (or PostgreSQL, but we won&#8217;t go into details on Postgres here &#8211; configuration is similar enough, no need to repeat what&#8217;s easy to google). We&#8217;ll assume that Apache2 is running under www-data user, and that you have your root password to MySQL.</p>
<p>We&#8217;ll assume that you have a way to access the server via SSH and that you can sudo.</p>
<p>And you have Python installed. Ubuntu 10.04 comes with Python 2.6 and does not intend to upgrade to 2.7, so if you want to upgrade, you&#8217;ll need to <a href="http://bjola.ca/coding/how-to-install-python-2-7-and-upgrade-mod_wsgi-on-ubuntu-10-04-lucid-lynx/">build Python 2.7 and mod_wsgi from sources</a>.</p>
<p>We&#8217;ll assume that you&#8217;ve got all that, and also the sources of the app to a server directory.</p>
<p>Let&#8217;s verify our assumptions. </p>
<ul>
<li>Check that you have Python (and learn what version you have):
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">$ python -V
Python 2.6.5</pre>
<p>		or (if you compiled and installed Python 2.7 by hand)</p>
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">$ python2.7 -V
Python 2.7</pre>
</li>
<li>Check that you have MySQL:
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">$ mysql -V
mysql  Ver 14.14 Distrib 5.1.63, for debian-linux-gnu (i486) using readline 6.1</pre>
</li>
<li>See if you have Apache2 and who&#8217;s running it:
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">$ ps -ef|grep apache
root     30596     1  0 02:29 ?        00:00:01 /usr/sbin/apache2 -k restart
www-data 32034 30596  0 03:45 ?        00:00:01 /usr/sbin/apache2 -k restart
www-data 32035 30596  0 03:45 ?        00:00:01 /usr/sbin/apache2 -k restart
www-data 32036 30596  0 03:45 ?        00:00:00 /usr/sbin/apache2 -k restart
...</pre>
</li>
<li>Finally, see that you can log in to MySQL as root:
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">$ mysql -u root --password=&lt;your password&gt;</pre>
</li>
</ul>
<p>If there are no errors so far, we&#8217;re ready to start.</p>
<h2>Set Up Database</h2>
<p>During development, it is ok to use sqlite3 for your Django app. But in production, we&#8217;ll need something more serious. Let&#8217;s say you already have a database name, a user name, and a password in settings.py file. Do you remember if you&#8217;ve already set up the DB in the past, or was it still on TODO list? Let&#8217;s check:</p>
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">
$ mysql --batch --skip-column-names -u &lt;username&gt; --password=&lt;userpass&gt; -e &quot;SHOW DATABASES LIKE &#039;&lt;dbname&gt;&#039;&quot;</pre>
<p>If it spits out the name of your database, you&#8217;ve already set it up. Otherwise, follow these three steps:</p>
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">
mysql -u root --password=&lt;rootpass&gt; -e &quot;CREATE DATABASE &lt;dbname&gt;&quot;
mysql -u root --password=&lt;rootpass&gt; -e &quot;GRANT USAGE ON *.* TO &lt;username&gt;@localhost IDENTIFIED BY &#039;&lt;userpass&gt;&#039;&quot;
mysql -u root --password=&lt;rootpass&gt; -e &quot;GRANT ALL PRIVILEGES ON &lt;dbname&gt;.* TO &lt;username&gt;@localhost&quot;&#039;,
</pre>
<p>Of course, if you plan to do everything by hand, it&#8217;s more convenient to log in to MySQL as root and do everything in its shell. But consider scripting this task, so that you don&#8217;t have to remember how to do it, ever again:</p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">
def check_mysql(dbname, username, userpass, rootpass):
    log.debug(&#039;Checking database %s...&#039; % dbname)
    db_match = None
    try:
        db_match = subprocess.check_output(&#039;mysql --batch --skip-column-names &#039;
                                           &#039;-u %(username)s --password=%(userpass)s &#039;
                                           &#039;-e &quot;SHOW DATABASES LIKE \&#039;%(dbname)s\&#039;&quot;&#039;
                                           % locals(), shell=True)
        log.debug(&#039;SHOW DATABASES said: %r&#039; % db_match)
    except subprocess.CalledProcessError, e:
        log.debug(&#039;show databases returned %s&#039; % e.returncode)
    if not db_match:
        commands = [
            &#039;mysql -u root --password=%(rootpass)s -e &quot;CREATE DATABASE %(dbname)s&quot;&#039;,
            &#039;mysql -u root --password=%(rootpass)s -e &quot;GRANT USAGE ON *.* TO %(username)s@localhost IDENTIFIED BY \&#039;%(userpass)s\&#039;&quot;&#039;,
            &#039;mysql -u root --password=%(rootpass)s -e &quot;GRANT ALL PRIVILEGES ON %(dbname)s.* TO %(username)s@localhost&quot;&#039;,
        ]
        for cmd in commands:
            thecmd = cmd % locals()
            log.debug(&#039;Running command: %s&#039; % thecmd)
            error = subprocess.call(thecmd, shell=True)
            if error:
                raise RuntimeError(&#039;Failed to set up database. Last command: %(thecmd)s. Error: %(error)s&#039; % locals())
</pre>
<p>A word of caution: using &#8220;shell=True&#8221; with subprocess.call is not safe if your input comes from outside your script. I am using it in mine, because I am in total control of the input data, and if I go mad and start feeding my own script destructive input, I&#8217;ve clearly got bigger problems than server security.</p>
<h2>Check Django Project Settings</h2>
<p>Now that your database exists and is accessible to the Django app, let&#8217;s have a look at the app settings to make sure it is configured correctly.</p>
<p>A common practice for developing Django apps is to have a set of debug-only settings for development, and a set of production-only settings for deployed app. A convenient way to do that is to add something like this at the end of your settings.py file:</p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">
try:
    from localsettings import *
except:
    pass
</pre>
<p>Create a file localsettings.py in the same directory, but do not include it into source control and do not deploy it to the server. Instead, on the server, create  a server-specific localsettings.py file. This way, you can use sqlite3 on dev machine, and a real database in production. </p>
<p>Your settings or localsettings now must contain correct DB connection info:</p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">

DATABASES = {
    &#039;default&#039;: {
        &#039;ENGINE&#039;: &#039;django.db.backends.mysql&#039;,
        &#039;NAME&#039;: &#039;your-db&#039;,
        &#039;USER&#039;: &#039;your-db-user&#039;,
        &#039;PASSWORD&#039;: &#039;your-db-pass&#039;,
        &#039;HOST&#039;: &#039;&#039;,
        &#039;PORT&#039;: &#039;&#039;,
    }
}
    </pre>
<p>Since we are using a script to verify our database, why not also script this part? It will look something like this:</p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">
def check_djangosettings(settings_dir, dbname, username, userpass):
    settings_fname = p(j(settings_dir, &#039;settings.py&#039;))
    settings = open(settings_fname)
    settings_text = settings.read()
    settings.close()
    if not (&#039;from localsettings import *&#039; in settings_text):
        # Need to fix settings module to import localsettings
        log.debug(&#039;Adding import localsettings to settings module: %s&#039; % settings_fname)
        settings_text += (&#039;\n&#039;
                          &#039;try:\n&#039;
                          &#039;    from localsettings import *\n&#039;
                          &#039;except:\n&#039;
                          &#039;    pass\n&#039;)
        f = open(settings_fname, &#039;w&#039;)
        f.write(settings_text)
        f.close()
    fname = p(j(settings_dir, &#039;localsettings.py&#039;))
    if os.path.exists(fname):
        log.debug(&#039;Localsettings module already exists: %s&#039; % fname)
        return
    log.debug(&#039;Creating localsettings module: %s&#039; % fname)
    f = open(fname, &#039;w&#039;)
    f.write(&#039;&#039;&#039;
DATABASES = {
    &#039;default&#039;: {
        &#039;ENGINE&#039;: &#039;django.db.backends.mysql&#039;,
        &#039;NAME&#039;: &#039;%(dbname)s&#039;,
        &#039;USER&#039;: &#039;%(username)s&#039;,
        &#039;PASSWORD&#039;: &#039;%(userpass)s&#039;,
        &#039;HOST&#039;: &#039;&#039;,
        &#039;PORT&#039;: &#039;&#039;,
    }
}
    &#039;&#039;&#039; % locals())
    f.close()
</pre>
<p>In this function, we use the localsettings trick to create a server-specific config.</p>
<h2>WSGI File</h2>
<p>Starting with Django 1.4, &#8220;django-admin startproject&#8221; gives you a nice starting point for WSGI config file. However, it needs to augmented if we want it to be useful.</p>
<p>But first, mod_wsgi needs to know where to load your Python from, in case you are using virtualenv. Simply open /etc/apache2/mods-enabled/wsgi.conf and add a line that looks like this:</p>
<pre class="brush: text; gutter: false; first-line: 1; highlight: []; html-script: false">
 WSGIPythonHome /path/to/my/virtualenv</pre>
<p>Now, for the WSGI script. All you really need to do is add your project&#8217;s directory to sys.path:</p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">
import os, sys

CWD = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
PROJECT_DIR = os.path.dirname(CWD)

sys.path.append(PROJECT_DIR)</pre>
<p>Of course, this should also be scripted:</p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">

def check_wsgi(project_dir, settings_dir):
    fname = p(j(settings_dir, &#039;wsgi.py&#039;))
    if os.path.isfile(fname):
        return
    if project_dir == settings_dir:
        settings_module = &#039;settings&#039;
    else:
        settings_module = &#039;%s.settings&#039; % os.path.basename(project_dir)
    site_packages = p(j(os.path.dirname(sys.executable),
                        &#039;..&#039;,
                        &#039;lib&#039;,
                        (&#039;python%s.%s&#039; % (sys.version_info.major, sys.version_info.minor)),
                        &#039;site-packages&#039;))
    f = open(fname, &#039;w&#039;)
    f.write(&#039;&#039;&#039;
import os, sys
os.environ.setdefault(&quot;DJANGO_SETTINGS_MODULE&quot;, &quot;%(settings_module)s&quot;)

CWD = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
PROJECT_DIR = os.path.dirname(CWD)

sys.path.append(&#039;%(site_packages)s&#039;)
sys.path.append(PROJECT_DIR)

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
    &#039;&#039;&#039; % locals())
    f.close()
</pre>
<h2>Database Schema</h2>
<p>Time to update your DB structure! If it&#8217;s the first time, you&#8217;ll need to do:</p>
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">python manage.py syncdb</pre>
<p>And on every update to the schema, don&#8217;t forget to migrate (assuming you are using South, which you should):</p>
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">python manage.py migrate --all</pre>
<p>Let&#8217;s script it, too:</p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">
def check_db_schema(project_dir):
    &#039;&#039;&#039;SyncDB and migrations
    &#039;&#039;&#039;
    log.debug(&#039;Updating database schema from %s&#039; % project_dir)
    cwd = os.getcwd()
    os.chdir(project_dir)
    for cmd in (&#039;syncdb&#039;, &#039;migrate -all&#039;):
        full_cmd = &#039;%s manage.py %s&#039; % (sys.executable, cmd)
        result = subprocess.call(full_cmd, shell=True)
        log.debug(&#039;%s returned: %s&#039; % (full_cmd, result))
    os.chdir(cwd)</pre>
<p>We&#8217;re getting close! So, at this point our database is in the correct shape, our web sever is good, and WSGI stuff is ready. Let&#8217;s start moving files to the right places.</p>
<h2>Copying Application Files</h2>
<p>On a server running multiple applications, a good practice is to have a directory somewhere outside /var/www to keep all of your Django applications. For each application we deploy, we&#8217;ll create a subdirectory, and put all its code, uploads, static data in there. (There are other sensible approaches &#8211; e.g. have a dedicated place for all media files and uploads for all apps, separate from sources, so YMMV). </p>
<p>Let&#8217;s name the subdirectories according to domain names of the applications &#8211; so, the app for my.domain.com will live under /path/to/apps/my_domain_com/. Copy the entire contents of your Django project, starting with the level where manage.py lives, into your my_domain_com directory and set ownership to www-data:www-data.</p>
<p>Python&#8217;s distutils has a handy function for &#8220;soft-copying&#8221; a directory tree, aptly named &#8220;copy_tree&#8221; &#8211; so, </p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">from distutils.dir_util import copy_tree

copy_tree(source, destination)</pre>
<p>To change ownership of a tree in Python, we do this:</p>
<pre class="brush: python; gutter: false; first-line: 1; highlight: []; html-script: false">pw_uid = pwd.getpwnam(&#039;www-data&#039;)
os.chown(dirname, pw_uid.pw_uid, pw_uid.pw_gid)</pre>
<p>After you&#8217;ve set up the directory and copied the app code, you also want to create two more things within the deployed app&#8217;s filesytem: logs and (optionally) uploads. This way, you&#8217;ll always find the logs of your application easily, and you&#8217;ll have everything sitting in one neat place. </p>
<p>Now, all that&#8217;s left to do is to add a site configuration in Apache, and we&#8217;re done.</p>
<h2>Apache2 Site Configuration</h2>
<p>Create a file under /etc/apache2/sites-available/, named just like your app directory. The contents of the file should look a bit like this:</p>
<pre class="brush: text; gutter: false; first-line: 1; highlight: []; html-script: false">&lt;VirtualHost *:80&gt;
    ServerAdmin you@yoursite.com
    ServerName www.domain.com
    ServerAlias domain.com

    Alias /static/ /path/to/your/app/static/

    &lt;Directory /path/to/your/app/static&gt;
        Order deny,allow
        Allow from all
    &lt;/Directory&gt;

    Alias /uploads/ /path/to/your/app/uploads/

    &lt;Directory /path/to/your/app/uploads&gt;
        Order deny,allow
        Allow from all
    &lt;/Directory&gt;

    LogLevel warn
    ErrorLog  /path/to/your/app/logs/apache_error.log
    CustomLog /path/to/your/app/logs/apache_access.log combined

    WSGIDaemonProcess %(app_name)s user=www-data group=www-data threads=20 processes=2
    WSGIProcessGroup your-app-name

    WSGIScriptAlias / path-to-your-app-wsgi-script
&lt;/VirtualHost&gt;</pre>
<p>Of course, this step is also included in the <a href="https://github.com/orlenko/django-apache-wsgi-util">full version of the script</a>.</p>
<p>On to the final step!</p>
<h2>Restart Apache</h2>
<pre class="brush: bash; gutter: false; first-line: 1; highlight: []; html-script: false">sudo apache2ctl restart</pre>
<p>&#8230;and you are done!</p>
<p>The full script automating this process can be found <a href="https://github.com/orlenko/django-apache-wsgi-util">here</a>. It&#8217;s open-source, use and modify it to your delight!</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/blog/deploying-django-application-apache-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drupal CMS Websites</title>
		<link>http://designpractica.com/featured/drupal-cms-websites/</link>
		<comments>http://designpractica.com/featured/drupal-cms-websites/#comments</comments>
		<pubDate>Thu, 05 Jul 2012 02:30:24 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=500</guid>
		<description><![CDATA[Drupal is a powerful and incredibly popular content management system written in PHP. Huge community of PHP developers makes it a safe choice if you want a CMS-based website with security, convenient back-end, extensibility, and lots of options for future growth. Drupal can be described as a hybrid between a CMS and a web framework, [...]]]></description>
				<content:encoded><![CDATA[<p>Drupal is a powerful and incredibly popular content management system written in PHP. Huge community of PHP developers makes it a safe choice if you want a CMS-based website with security, convenient back-end, extensibility, and lots of options for future growth. </p>
<p>Drupal can be described as a hybrid between a CMS and a web framework, and in this sense it gets close to our favourite web development platform of all times &#8211; Django. We won&#8217;t get into holy war of languages and web development tools here. Besides the fact that every CMS and framework has its unique merits, often customers have their own reasons to prefer a certain set of technologies for their web applications.</p>
<p><img src="http://designpractica.com/wp-content/uploads/2012/07/slide1-300x255.png" alt="Drupal CMS Sites" title="Drupal CMS Sites" width="300" height="255" class="alignright size-medium wp-image-507" /></p>
<p>Recently we completed two Drupal-based projects, <a href="http://bespoke-online.com">bespoke-online.com</a> and <a href="http://kazookyloyalty.com">kazookyloyalty.com</a>. </p>
<p>A few notable things about Drupal: </p>
<p>First of all, of course, it&#8217;s open source. So is every module and plugin that we use with it. We have full access to the inner mechanics of the framework and all its extra parts.</p>
<p>Drupal has a mature system of modules/plugins, and a great selection of them for every kind of need &#8211; from WYSIWYG editing to email connectors and flexible web forms. </p>
<p><img src="http://designpractica.com/wp-content/uploads/2012/07/slide2-300x255.png" alt="Drupal Custom Webapps" title="Drupal Custom Webapps" width="300" height="255" class="alignleft size-medium wp-image-509" /></p>
<p>Drupal&#8217;s template system is well thought-out and extremely flexible. It allows theme author to fully control all parts of every page, distinguish between kinds of content, and override defaults for specific pages, if needed.</p>
<p>Drupal is production-ready and has better reputation with regards to security than its PHP relatives, like WordPress. </p>
<p>In short, we love Drupal almost as much as we love Python and Django. Design Practica makes custom web applications in Django, Google AppEngine, WordPress, Drupal and a bunch of other technologies. You can <a href="/request-a-free-quote/">contact us to get a brand new website or to update and existing one</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/featured/drupal-cms-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Online Store for a Local Manufacturer</title>
		<link>http://designpractica.com/featured/online-store-local-manufacturer/</link>
		<comments>http://designpractica.com/featured/online-store-local-manufacturer/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 18:32:10 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=471</guid>
		<description><![CDATA[One of web applications we built recently was a custom online store for Niche Professional, a hair product company in Vancouver, BC. Niche wanted a website that would sell their shampoos, conditioners and other products to consumers and inform potential business partners about options to buy bulk, get samples, and set up long-term relationships. The [...]]]></description>
				<content:encoded><![CDATA[<p>One of web applications we built recently was a custom online store for Niche Professional, a hair product company in Vancouver, BC.</p>
<p>Niche wanted a website that would sell their shampoos, conditioners and other products to consumers and inform potential business partners about options to buy bulk, get samples, and set up long-term relationships. The store site had to be scalabe, easy to maintain, and convenient to tune for SEO &#8211; you&#8217;ve got to be liked by Google if you want to be noticed on the web.</p>
<p>We built a flexible, SEO-optimizable, modern online store for our customer based on <a href="https://www.djangoproject.com/">Django</a> and <a href="http://www.satchmoproject.com/">Satchmo</a>. Satchmo is one of the most popular Python-based ecommerce frameworks. Built on top of Django, arguably the most elegant web application engine, it provides web developers with a way to quickly create scalable, flexible eCommerce systems. For dynamic features on the browser side, we used jQuery, of course.</p>
<p>Here&#8217;s how Satchmo, Django, jQuery and other tools have enabled us to quickly create a functional, dynamic website that acts both as a CMS and an eCommerce system, and is easy to manage by its owners.</p>
<h2>Security</h2>
<p>For an online store, this is the most important factor. If you do everything else on your eCommerce website right, but ignore security, you will end up harming your customers, hurting your reputation, losing money, potentially destroying your business beyond repair. So we&#8217;ve got to think about security first. Because of the way Django application model is designed, it facilitates creation of secure websites more than many other popular web technologies. Built-in features such as cross-site forgery protection help save development time and allow everyone involved to focus on the real business goals of the project, instead of worrying about every detail. Satchmo allows to integrate the online store with a variety of payment gateways, and encourages a well-though-through, safe approach to handling payments and customer information.</p>
<h2>Flexibility</h2>
<p>To successfully sell products from your website, you need complete control over all the aspects of the site. With Django, we can tune everything: the way URLs of the website are organized, the appearance of the pages (Django  has a powerful templating system), the database, caching system, admin features, and so on. Satchmo gave us great flexibility in choosing payment methods, automating shipping cost calculations,<br />
generating PDF documents (invoices, shipping labels), and managing custom discounts.</p>
<h2>Unique Design</h2>
<p>I&#8217;ve already mentioned the powerful support for page templates that comes with Django. Django templates allow designers and programmers to collaborate in a productive fashion, without worrying about each other&#8217;s parts in the process. Unlike older web programming technologies, such as ASP or PHP, Django templates enable us to work on the visual aspects of a site independent from the server-side data management. Likewise, changes to business rules or logic on the server can happen without wreaking havoc on the visual side of things. This separation of concerns allows our graphic design team to focus on the presentation aspects of the site and create unique, usable pages, while the programmers implement the logic of the application.</p>
<h2>Updates</h2>
<p>How easy or difficult it is to update your site&#8217;s content and design can define your site&#8217;s success or failure in the long run. New products, new information, new ways to present it &#8211; all this must be easy to do on your site if you want it to perform well. With Django and its templating system, your website&#8217;s design is organized in a hierarchy. This makes it very convenient to update overall design and layout of the site. Changing things like header or footer on all pages uniformly, adding a sidebar, or popping a message about special offer &#8211; with well-organized page templates, these things do not cause trouble. In fact, with this online store project, we went though several revisions of overall design and layout, without interrupting the functionality of live website.</p>
<h2>Payment System</h2>
<p>Satchmo has built-in support for major payment gateways, such as Authorize.net, PayPal, and a handful of others. It also provides a straightforward way to add new payment plugins. So, when we found we needed to add support for MiraPay, a Canadian merchant service, we simply added a plugin that implemented MiraPay&#8217;s API. Satchmo allows site creators to have multiple payment methods, which is a great thing &#8211; many customers are expecting to be able to pay through their PayPal account, while others prefer to use direct credit card payment.</p>
<h2>Shipping Cost Calculation</h2>
<p>Evaluating the cost of shipment is not a trivial task. Satchmo has great plugins for this, able to communicate directly with carrier companies to get a precise price for each shipment. As with other aspects of commerce, shipping with Satchmo can be easily customized to implement any specific rules that apply to a given business. Out of the box, it supports integration with the following carriers:</p>
<ul>
<li>UPS</li>
<li>Fedex</li>
<li>USPS</li>
<li>Canada Post</li>
<li>Flat rate shipping</li>
<li>Multi-tiered shipping based on quantity or price</li>
<li>Per item shipping cost</li>
</ul>
<h2>Discounts, Special Offers, Coupons</h2>
<p>Satchmo comes pre-packaged with support for discounts and coupons. Default templates provide a nice starting point for  showing discount information, giving the customer information about special offers, handling the whole process gracefully and correctly (the most important part). Customizing Satchmo templates proved to be a pretty straightforward process, and we were able to take full advantage of its support for coupon codes and specials. Again, this area is extensible, and if your website, like our case here, needs special custom rules for discounts, it&#8217;s convenient to implement them using Satchmo.</p>
<h2>Custom Products</h2>
<p>Some of the products our client sells through the website are customizable &#8211; you can choose certain options before purchasing, and the price adjusts accordingly. This is where Satchmo proved most helpful. In fact, it supports several flavours of customizability &#8211; as long as you know what you need, you can get it with Satchmo.</p>
<h2>Subscription-Based Products and Downloadable Producst</h2>
<p>Although we did not use subscriptions in this project, and downloading a bottle of shampoo is not quite yet possible with today&#8217;s technology, it&#8217;s worth mentioning these Satchmo capabilities here. Satchmo can just as easily sell your ebooks or software, or a paid subscription to monthly market insider tips, as it sells conditioners. </p>
<p>In short, as a web development company, we are excited that such high-quality frameworks as Django and Satchmo exist in open-source world. This gives is the power to solve our customers&#8217; problems elegantly, with confidence and speed.</p>
<p>Contact DesignPractica to <a href="/request-a-free-quote">discuss your eCommerce or custom web project</a>. We give free estimates.</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/featured/online-store-local-manufacturer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DesignPractica Offers Security Consulting for WordPress-based Websites</title>
		<link>http://designpractica.com/press/designpractica-offers-security-consulting-wordpress-based-websites/</link>
		<comments>http://designpractica.com/press/designpractica-offers-security-consulting-wordpress-based-websites/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 02:02:44 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Press]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=466</guid>
		<description><![CDATA[DesignPractica, a Vancouver-based web development company, offers expert help in securing WordPress websites. As recent widespread vulnerabilities in WordPress plugins continue to affect site owners, DesignPractica offers services to restore, clean up and secure WordPress installations. Vancouver, BC Nov 25, 2011 – DesignPractica, a company that specializes in web development and support, after its experience [...]]]></description>
				<content:encoded><![CDATA[<p>DesignPractica, a Vancouver-based web development company, offers expert help in securing WordPress websites. As recent widespread vulnerabilities in WordPress plugins continue to affect site owners, DesignPractica offers services to restore, clean up and secure WordPress installations.</p>
<p>Vancouver, BC Nov 25, 2011 – DesignPractica, a company that specializes in web development and support, after its experience with recent WordPress attacks, shares the expertise through its new offer to restore and secure WordPress-based websites. </p>
<p>DesignPractica has been building and supporting websites and dynamic web applications since 2009. Its team of professionals is now providing additional support for owners of sites who suffered from hacker attacks against WordPress plugins.</p>
<p>According to internet security agencies, such as SpiderLabs, there are 1.2 million websites that were affected by the latest attack. “We&#8217;ve had our share of trouble with this vulnerability, and now we want to share what we learned so that other can benefit from our efforts”, says DesignPractica founder Vlad Orlenko.</p>
<p>For additional information about WordPress vulnerabilities, restoring your website and security help, contact Vlad Orlenko at <a href="mailto:vlad@designpractica.com">vlad@designpractica.com</a> or visit <a href="http://www.designpractica.com">www.designpractica.com</a>. </p>
<p>(as seen in all major online news outlets)</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/press/designpractica-offers-security-consulting-wordpress-based-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress One-Step Backup/Restore Script</title>
		<link>http://designpractica.com/download/wordpress-one-step-backuprestore-script/</link>
		<comments>http://designpractica.com/download/wordpress-one-step-backuprestore-script/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 09:23:32 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Download]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=463</guid>
		<description><![CDATA[Here&#8217;s a script that runs backups for DesignPractica and can restore a wordpress site in a single command: [dowload]. Read the whole article about my WordPress sites getting hacked and getting them back on track.]]></description>
				<content:encoded><![CDATA[<p><a href="/wp-content/uploads/wpbackup.tar.gz" title="Backup/Restore script">Here&#8217;s a script</a> that runs backups for DesignPractica and can restore a wordpress site in a single command: <a href="/wp-content/uploads/wpbackup.tar.gz" title="Backup/Restore script">[dowload]</a>. <a href="/blog/what-to-do-when-your-website-is-hacked/">Read the whole article</a> about my WordPress sites getting hacked and getting them back on track.</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/download/wordpress-one-step-backuprestore-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DesignPractica Expands Into eCommerce for Websites and Custom CMS</title>
		<link>http://designpractica.com/press/designpractica-expands-ecommerce-custom-cms-services/</link>
		<comments>http://designpractica.com/press/designpractica-expands-ecommerce-custom-cms-services/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 07:30:41 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Press]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=429</guid>
		<description><![CDATA[DesignPractica, a web design and development company, is proud to announce that it now offers support and custom development with all top eCommerce and CMS frameworks. Vancouver, BC Nov 21, 2011 &#8211; DesignPractica has been creating and maintaining custom websites for small businesses in Greater Vancouver area for several years. Now, in addition to offering [...]]]></description>
				<content:encoded><![CDATA[<p>DesignPractica, a web design and development company, is proud to announce that it now offers support and custom development with all top eCommerce and CMS frameworks.</p>
<p>Vancouver, BC Nov 21, 2011 &#8211; DesignPractica has been creating and maintaining custom websites for small businesses in Greater Vancouver area for several years. Now, in addition to offering WordPress, Django and Google Application Engine websites, DesignPractica also provides support and development services with all top open-source and hosted eCommerce and CMS systems, such as Magento, Drupal, Volusion, Shopify, Satchmo and others, for small, medium and large businesses in the greater Vancouver region. Adding ecommerce for website has become a necessary feature of modern online presence, and DesignPractica is increasing its efforts to satisfy the demand.</p>
<p>DesignPractica has a successful history of helping local manufacturers, farmers, restaurants and entrepreneurs with web design and <a href="http://designpractica.com/featured/custom-web-application-development/" title="Custom Web Application Development">custom web application development</a>. Over the years, it has accumulated expertise and gathered brilliant talent in its distributed team of designers, analysts, marketers, and programmers. Now it is stepping up its effort to deliver the best web products that can be created with today&#8217;s top technical tools to local Vancouver businesses. The solutions DesignPractica provides allow customers to add ecommerce for software products, traditional goods, subscription services and more.</p>
<p>&#8220;We feel that by providing best tools available on the market, such as Magento eCommerce framework, we can bring great value to local businesses looking to build new sales channels and to take advantage of online marketing&#8221;, says Vlad Orlenko, founder of DesignPractica. &#8220;But instead of pushing a single solution to every customer, we begin with analyzing the needs of every particular business that works with us &mdash; not everyone requires the same product, and <a href="http://designpractica.com/featured/ecommerce/" title="Custom eCommerce Websites">personalized approach to eCommerce and CMS</a> in today&#8217;s complex world is our great strength&#8221;. </p>
<p>Combining the advantages of global team and local business presence, DesignPractica sets an ambitious goal of building dozens of <a href="http://designpractica.com/featured/ecommerce/" title="Custom eCommerce Websites">modern, efficient internet stores</a> that will appeal to the public and provide strong sales for the business owners over the next months, starting this Christmas season. Introduction of ecommerce for websites that did not previously have it is a welcome news.</p>
<p>For additional information about eCommerce and CMS development services provided by DesignPractica, contact Vlad Orlenko at <a href="mailto:vlad@designpractica.com" title="Email Vlad Orlenko">vlad@designpractica.com</a> or visit <a href="http://designpractica.com" title="DesignPractica: custom eCommerce and CMS websites">www.designpractica.com</a>. </p>
<p>(as seen in all major online news outlets)</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/press/designpractica-expands-ecommerce-custom-cms-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ecommerce for Website</title>
		<link>http://designpractica.com/featured/ecommerce/</link>
		<comments>http://designpractica.com/featured/ecommerce/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 16:08:42 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Services]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=409</guid>
		<description><![CDATA[We build customized online stores that are uniquely suited to the way your business works. Whether you want to add a simple shopping cart to your existing site, or to build a focused search-engine-optimized web storefront, we can help your sales and your business grow. We can even add ecommerce for website that already exists, [...]]]></description>
				<content:encoded><![CDATA[<p>We build customized online stores that are uniquely suited to the way your business works. Whether you want to add a simple shopping cart to your existing site, or to build a focused search-engine-optimized web storefront, we can help your sales and your business grow. We can even add ecommerce for website that already exists, turning your traditional website into a selling machine.</p>
<p>The online store that we build for you serves one goal: bring you lots of sales. But to achieve this seemingly simple task, it takes a lot of knowledge, skills and experience.</p>
<p>The store has to automate all the parts of the process that can be automated, such as creating invoices and shipping labels, calculating shipping costs and taxes, offering the right discounts and encouraging customers to buy related products. </p>
<div class="sidenote right">Things that matter for an online store:</p>
<ul>
<li>Flexible payment system</li>
<li>Intuitive inventory management</li>
<li>SEO features</li>
<li>Statistics Analysis and Reports</li>
</ul>
</div>
<p>We always build our sites with search engine optimization (SEO) in mind. Things like standards-based layout and styling, customizable titles and headers, easily-editable content are absolutely necessary for promoting your site with Google, Bing and Yahoo, and we make sure your online store gives you all that today&#8217;s web is capable of. </p>
<p>Depending on the business you&#8217;re in, we&#8217;ll suggest a suitable set of options for online sales. </p>
<p>For example, if you already have a working website with a healthy amount of traffic to it, you do not want to lose all the work that went into it and start from scratch. Fortunately, the powerful tools we use allow us to add e-commerce features to an existing website without interrupting the service or interfering with the relationships you already have with your customers.</p>
<p>If you are planning to build a new online store, we&#8217;ll help you choose from the multitude of available technologies and tools (which can be quite overwhelming) the right ones for the job, ensuring fast delivery and cost-effectiveness and easy maintenance in the future. Our goal is to design an approach that will work best while adding the benefits of ecommerce for website that you are either building from scratch or updating.</p>
<p>The main benefit of creating a customized online store is that you have full control over the behavior and appearance of your virtual storefront. You can manage the discounts and shipping the way you like it, customize product information in precisely the manner that maximizes your conversion rate, and optimize your site for search engines so that you know you are getting the maximum benefit out of your &#8220;automated sales engine&#8221;.</p>
<p>We work with a wide variety of popular e-commerce systems:</p>
<div class="sidenote right"><a href="/request-a-free-quote/">Get a free quote for your online store</a>, be it a simple shopping-cart addition to an existing site or a brand new web sales project.</div>
<ul>
<li>Magento</li>
<li>Satchmo</li>
<li>Shopify</li>
<li>OpenCart</li>
<li>WP e-Commerce</li>
<li>Volusion</li>
<li>osCommerce</li>
<li>UberCart</li>
<li>ZenCart</li>
<li>and many more&#8230;</li>
</ul>
<p>In any web-related project, but especially in online sales, tracking statistics about your visitors is absolutely necessary. That&#8217;s why we always include Google Analytics with all the sites that we build. Additional reporting is available depending on the e-commerce framework that is chosen for a particular project, and we help you take full advantage of that.</p>
<p>We also integrate your site with social networks &mdash; Facebook, Twitter, FourSquare, Google Plus, etc., and help you make first steps in SEO for your online store &mdash; from optimizing the content and format of the site to registering in directories and building links. </p>
<p>In addition to the technical aspects of building the system for you, we take training and education very seriously. We provide instructional videos for our clients, showing how to manage their website by example, which is the best way to learn.</p>
<p>So, in short, here&#8217;s our secret sauce: we combine the power of <strong>industry-standard CMS frameworks</strong> and <strong>proven e-commerce solutions</strong> with <strong>custom design and programming</strong>, add generous amounts of uncompromising <strong>focus on your business and your clients</strong>, and produce great value for you and your company. </p>
<p>To get a free estimate for your e-commerce project, please leave a reply below, or drop us a call at 604-200-3537.</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/featured/ecommerce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First page in Google search results!</title>
		<link>http://designpractica.com/blog/first-page-in-google-search/</link>
		<comments>http://designpractica.com/blog/first-page-in-google-search/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 03:52:06 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=400</guid>
		<description><![CDATA[Wow, according to Google, we&#8217;re #1 Django shop in Coquitlam! Design Practica is on the first page of Google search results for things like &#8220;coquitlam custom web development&#8221; and &#8220;django coquitlam&#8221;. Of course, &#8220;Coquitlam&#8221; sort of narrows it down a lot, but we still feel very proud. We should start boasting about our SEO skills! [...]]]></description>
				<content:encoded><![CDATA[<p>Wow, according to Google, we&#8217;re #1 Django shop in Coquitlam! Design Practica is on the first page of Google search results for things like &#8220;coquitlam custom web development&#8221; and &#8220;django coquitlam&#8221;. Of course, &#8220;Coquitlam&#8221; sort of narrows it down a lot, but we still feel very proud. We should start boasting about our SEO skills! Just kidding. What got us here was common sense and attention to detail, nothing more. Anyone can do it, with some <a href="/request-a-free-quote/">professional web development help</a>.</p>
<p>We are doing our best creating Django applications in Coquitlam, Burnaby, Port Moody, and the whole Greater Vancouver.</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/blog/first-page-in-google-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Web Application Development</title>
		<link>http://designpractica.com/featured/custom-web-application-development/</link>
		<comments>http://designpractica.com/featured/custom-web-application-development/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 22:22:52 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Services]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=385</guid>
		<description><![CDATA[We build custom web applications. Websites for e-commerce, promotional sites, CMS-based applications, sites for mobile users. Custom application development is a wide area. In a few paragraphs, here&#8217;s how it works. First, we listen to you to understand what exactly you need to build. We ask lots of questions about your purposes for the project, [...]]]></description>
				<content:encoded><![CDATA[<p>We build custom web applications. <a href="/featured/ecommerce/" title="E-Commerce sites">Websites for e-commerce</a>, promotional sites, CMS-based applications, sites for mobile users. Custom application development is a wide area. In a few paragraphs, here&#8217;s how it works.</p>
<ul>
<li>First, we listen to you to understand what exactly you need to build. We ask lots of questions about your purposes for the project, the way different people will be using it, the other systems it will interact with. We can meet in person, if you are located in Vancouver area, or talk by phone, Skype, IM – whatever works best for you. (Just drop us a message about the project, and we&#8217;ll get back to you on the same day.)</li>
<li>We make an estimate of the project, for free. You get a detailed list of steps covering the entire project, from analysis and design to implementation details, sketches or examples of design, and an approximate evaluation of the cost. We strive to use fixed estimates and stick to them wherever possible, because this is the most comfortable way for you, our customer. However, if there&#8217;s a significant change of plans during the course of the project, we&#8217;ll re-estimate as we go.</li>
<li>Once we&#8217;ve agreed on the plan of action, we take a deposit and begin to implement your web application. We focus on early visibility and constant interaction with the customer, so that you can see what is being built, you can test-drive it, and get all the important details and clarifications to us.</li>
</ul>
<div class="right sidenote"><a href="http://nichelabel.com" target="_blank">nichelabel.com</a> and <a href="/featured/featured-customer-niche-professional-branding/">nicheprobrand.com</a> are recent examples of custom projects we implemented: an <a href="/featured/ecommerce/" title="E-Commerce sites">online store</a> we built with Satchmo, Django, and jQuery, and a promotional site with built-in 3D image processing feature. The design and functionality of these sites were customized to fit our customer&#8217;s business and ideas.</div>
<p>Different projects require different sets of instruments. In our custom development work, we use a very wide variety of tools and technologies. We love open-source tools such as Django web application framework, Satchmo online store engine, CMS frameworks &mdash; from WordPress and Drupal to Magento and Django-CMS, Ruby/Rails, JQuery, Sencha, etc. We also use .NET, mobile frameworks, and desktop and mobile development tools for Linux, Windows and Mac. </p>
<p>Contact us to <a href="/request-a-free-quote/">discuss your custom project</a>. You&#8217;ll be glad you did.</p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/featured/custom-web-application-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What To Do When Your Website Is Hacked: Recover in 10 Steps</title>
		<link>http://designpractica.com/blog/what-to-do-when-your-website-is-hacked/</link>
		<comments>http://designpractica.com/blog/what-to-do-when-your-website-is-hacked/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 21:59:19 +0000</pubDate>
		<dc:creator>vlad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://designpractica.com/?p=335</guid>
		<description><![CDATA[[To skip to downloadable file for this post, click here.] So, my site got hacked. No, scratch that. All of my WordPress sites got hacked. No, that&#8217;s not right either. All of my WordPress sites got hacked twice. I&#8217;ve repaired it all, prepared the sites for the next vulnerability, and now I&#8217;m ready to share [...]]]></description>
				<content:encoded><![CDATA[<p><i>[To skip to downloadable file for this post, <a href="#download">click here</a>.]</i></p>
<p>So, my site got hacked. No, scratch that. <em>All</em> of my WordPress sites got hacked. No, that&#8217;s not right either. <em>All</em> of my WordPress sites got hacked <em>twice</em>. I&#8217;ve repaired it all, prepared the sites for the next vulnerability, and now I&#8217;m ready to share my regrets and shame, but mostly experience and tools.</p>
<p>While nobody can guarantee that a WordPress site is not going to be hacked again, there are a few things we can do to lower the risk and make it much easier to bounce back when this happens.</p>
<p><strong>Backups, man!</strong> Do you have a recent backup of your site? How long will it take you to get back in the game if you start seeing, all of a sudden, pop-up ads for penis enlargement on your blog? Backups, man, backups. Back up your data, your plugins, your custom styles, everything. Store your backups off-site. All of this is common sense, but most of us start taking this stuff seriously only after a disaster. </p>
<p>At the end of this post, there&#8217;s a script that makes backing or restoring a WordPress site a one-step process. But if your site is hacked and you need to go through all the steps before creating the first clean backup, read on.</p>
<p>&nbsp;</p>
<div style="float:right; padding: 10px;">
<a href="http://www.dpbolvw.net/fh77qgpmgo3996C549354CA8C79" target="_blank" title="AVG Antivirus"><br />
<img src="http://www.ftjcfx.com/rf121uuymsqBHHEKDCHBDCKIGKFH" alt="Save 36% on 2 year license AVG Antivirus Pro" border="0"/></a>
</div>
<h2>Step 1: Scan your PC</h2>
<p>&nbsp;</p>
<p>Often malware is introduced to a website through an infected Windows machine that you use to manage the site. Update your antivirus software and do a full scan of your computer. You want to be sure that your local computer is clean before you start repairing your website from it.</p>
<p>If you do not have an antivirus, <a href="http://www.kqzyfj.com/click-5528105-10639599" target="_blank" title="AVG Antivirus">AVG is good choice</a><img src="http://www.tqlkg.com/image-5528105-10639599" width="1" height="1" border="0"/>. They have a free version, and the prices for the paid license are very reasonable. </p>
<p>Some malware is very good at hiding from certain types of antivirus software. If you already have an antivirus, it may be a good idea to double-check and scan your PC with another type of antivirus. </p>
<p>&nbsp;</p>
<h2>Step 2: Verify that your site is infected</h2>
<p>&nbsp;</p>
<div style="float:right;padding: 10px;">
<a target="_blank" href="http://affl.sucuri.net/?affl=f4c0cea6a31587a7a935d24071553025" title="Sucuri Site Scanner"><img src="http://sucuri.net/images/gotmalware.png" title="Sucuri Site Scanner" /></a>
</div>
<p>How can you be sure that your site has been hacked and has malware? How can you check which of your sites are clean and which are infected?  Use an <a href="http://affl.sucuri.net/?affl=f4c0cea6a31587a7a935d24071553025" target="_blank" title="Sucuri Site Scanner">online site scanner</a>. Scan every one of your websites before you start cleaning them up, and repeat the scan as you progress through the steps to restore sanity. Make it a habit to re-scan your sites regularly, or subscribe to Sucuri Monitor or a similar service.</p>
<p>&nbsp;</p>
<h2>Step 3: Back up your website</h2>
<p>&nbsp;</p>
<p>Although your site is infected, you still want to keep a copy of all its data and files for reference, at least until you make sure that all is back to normal.</p>
<p>Make a backup copy of your website&#8217;s files. If you have SSH access to your hosting provider, copy the entire directory containing your site into a backup location. If you use another way to access your files (such as SFTP, FTP, or web-based file manager), download the whole directory of the site. </p>
<p>Back up the database your site uses. In WordPress, you can download the content through &#8220;Tools > Export > All content&#8221; in the admin dashboard. Or, preferably, use a command line to export the whole database. </p>
<p>I&#8217;ve created a useful script that does both of these steps for a WordPress site automatically (it&#8217;s at the end of this article).</p>
<p>&nbsp;</p>
<h2>Step 4: Talk to your hosting provider</h2>
<p>&nbsp;</p>
<p>Most likely, the issue affects more than just your website, and your hosting provider is already aware of the problem. Most hosting companies back up their customers&#8217; data regularly, and if your site was infected recently, they can simply restore it to a previous point, when it was not yet infected. They can also help you identify and fix the vulnerability that led to the problem in the first place. If you are lucky and your hosting support rocks, things will be back to normal before you know it. For the rest of us, there are next steps.</p>
<p>&nbsp;</p>
<h2>Step 5: Try Surgical Repair</h2>
<p>&nbsp;</p>
<p>This does not always work, but it&#8217;s worth a try. If you know the kind of attack that led to the site&#8217;s infection with malware (e.g. the infamous TimThumb vulnerability), and you can find good documentation on how the attack works, you can try to clean up the affected PHP files. There are a few <a href="http://wordpress.org/extend/plugins/antivirus/" target="_blank">WordPress plugins</a> that can help. After every change you make, verify whether the site is infected (use <a href="http://affl.sucuri.net/?affl=f4c0cea6a31587a7a935d24071553025" target="_blank" title="Sucuri Site Scanner">Sucuri Scanner</a>) and if it&#8217;s clean, verify that it works. It did? Congratulations! You&#8217;re done.</p>
<p>However, this method does not always work (as malware writers are coming up with new ways to hide malicious code), and sometimes you&#8217;ll have to scrap all code and install a clean copy. </p>
<p>&nbsp;</p>
<h2>Step 6: Disable the infected site</h2>
<p>&nbsp;</p>
<p>Sigh, so you&#8217;ve tried to remove the bad code from PHP source, and the site is still broken. You&#8217;ll need to set up the WordPress, the theme and plugins from clean slate, re-import the data, and monitor the whole process so that you know at the end of the process your site is clean and fully-functional.</p>
<p>To begin, let&#8217;s completely isolate the site from the outside world. The malware that got injected into your site could be acting as a backdoor, bringing more malware in. To prevent the malicious code from re-infecting the site while you&#8217;re cleaning it up, temporarily close it down. </p>
<p>A simple way to disable a site that runs under Apache (which WordPress does) is to add a rewrite rule into .htaccess file in the site&#8217;s directory, redirecting all requests to a temporary &#8220;your site is undergoing maintenance&#8221; page.</p>
<p><code>
<pre>
RewriteEngine on
rewriterule ^(.*)$ http://example.com/maintenance.html [r=301,nc]
</pre>
<p></code></p>
<p>(You&#8217;ll need to set up the maintenance page somewhere outside of your site, of course).</p>
<p>Now open your website in browser &mdash; you should see the maintenance message instead of the site itself. </p>
<p>What have you achieved so far? Your data is backed up, you&#8217;re sure that your local machine will not infect the website  and you&#8217;ve isolated the site from the outside world. Now you&#8217;re ready to begin the cleanup.</p>
<p>&nbsp;</p>
<h2>Step 7: Change Passwords</h2>
<p><img src="http://designpractica.com/wp-content/uploads/2011/11/change-all-passwords.gif" alt="" title="change-all-passwords" width="320" height="240" class="alignright size-full wp-image-356" /><br />
Change all the passwords. Don&#8217;t leave the bastards a chance.</p>
<p>Don&#8217;t forget to go through <em>all</em> of the passwords that may have leaked:</p>
<ul>
<li>SSH password</li>
<li>Hosting Control Panel password</li>
<li>FTP password</li>
<li>Database password for every database accessible to your account</li>
</ul>
<p>&nbsp;</p>
<h2>Step 8: Complete Clean Up </h2>
<p>&nbsp;</p>
<p>This part will have to be repeated for every website you are repairing. With the right tools (such as the backup/restore script below), it takes about an hour or two per site. Not too terrible. </p>
<ol>
<li>
		Create a fresh WordPress application instead of the temporarily-disabled site. Use the newest version of WordPress and a new database.</p>
<ul>
<li>
				At this point, your WordPress should be working and free of malware. <a target="_blank" href="http://affl.sucuri.net/?affl=f4c0cea6a31587a7a935d24071553025" title="Sucuri Site Scanner">Check for malware</a> &mdash; if it&#8217;s there, you&#8217;ve got a problem. Either your PC is infected, or you have a more serious issue on the server. Stop here, call support, <a href="http://www.kqzyfj.com/click-5528105-10639599" target="_blank" title="AVG Antivirus">run a virus scan</a><img src="http://www.tqlkg.com/image-5528105-10639599" width="1" height="1" border="0"/> on your PC.
			</li>
<li>
				If the site is clean like it should be, proceed.
			</li>
</ul>
</li>
<li>Create a backup copy of site directory and database. This is your new clean copy &#8211; not very useful yet, but at least it will let you come back to this point if you make a mistake at a later step.</li>
<li>Install the most recent version of the theme you want to use (make sure the theme does not use modules with known vulnerabilities &mdash; such as certain versions of TimThumb).</li>
<li>Check for malware again. If the site got infected, it&#8217;s likely the theme. Roll back to the backup you created two steps back (good thinking!), and use another theme. If it&#8217;s clean, make anoter backup copy and proceed.</li>
<li>For every plugin you need to use:
<ul>
<li>Install latest version of plugin</li>
<li>Check site for malware</li>
<li>Roll back or create new backups as necessary</li>
</ul>
</li>
</ol>
<p>&nbsp;</p>
<h2>Step 9: Restore the data</h2>
<p>&nbsp;</p>
<p>Now that your site looks and behaves close to what it should, time to import old data. We&#8217;ll assume that there are no viruses or malware in the database. That&#8217;s a reasonable assumption, but before you act on it, please make sure you&#8217;ve backed up all your work prior to this point. Ready? </p>
<p>Export the database your site used to use. You can do it through phpMyAdmin or from command line.. The command will look something like this (all in one line):</p>
<p><code>
<pre>
mysqldump --user=&lt;old_db_user&gt; --password=&lt;old_db_password&gt;
        --databases &lt;old_db_name&gt; --opt --quote-names --allow-keywords
        --complete-insert -c &gt; &lt;archive_filename&gt;.sql
</pre>
<p></code></p>
<p>And to load it all into the new database, you&#8217;ll import it &mdash; either through phpMyAdmin or through a command line like this one:</p>
<p><code>
<pre>
mysql --user=&lt;new_db_username&gt; --password=&lt;new_db_password&gt; &lt;new_db_name&gt; &lt; &lt;sql_file&gt;
</pre>
<p></code></p>
<p>Now, for the last time (hopefully) check that your site does not have any malware, and you&#8217;re done!</p>
<p>&nbsp;</p>
<p>Except that you are not really done. Time to make sure that an ordeal like this never happens again to you and your websites.</p>
<p>&nbsp;</p>
<h2>Step 10: An ounce of prevention is worth a pound of cure</h2>
<p>&nbsp;</p>
<p>Or, in metric system, &#8220;twenty-eight grams of prevention is about half-a-kilogram of cure&#8221;, which sounds admittedly much less elegant.</p>
<p>Here&#8217;s what you can and should do to protect yourself against future attacks.</p>
<ul>
<li>Follow the advice in the <a href="http://codex.wordpress.org/Hardening_WordPress" title="Hardening WordPress" target="_blank">official guide on hardening WordPress</a>. </li>
<li>Before installing a new WordPress plugin or theme, at least Google for vulnerabilities related to it. </li>
<li>Monitor your site &mdash; use <a href="http://affl.sucuri.net/?affl=f4c0cea6a31587a7a935d24071553025" target="_blank" title="Sucuri Site Scanner">Sucuri</a> or a similar tool.</li>
<li>Keep your PC clean and secure. Don&#8217;t neglect your <a href="http://www.kqzyfj.com/click-5528105-10639599" target="_blank" title="AVG Antivirus">Windows antivirus</a><img src="http://www.tqlkg.com/image-5528105-10639599" width="1" height="1" border="0"/>.</li>
<li>Make automatic backups that let you easily restore your site.</li>
<li>Consider not using WordPress for serious sites. Use Django, Rails, heck, even .NET. Some platforms just take security more seriously than others.</li>
<li>If your hosting provider is not helping you in terms of backups and recovery, move to one that does. <a href="http://www.webfaction.com?affiliate=bjola" target="_blank" title="Good hosting">Webfaction</a> (where this site is hosted) is probably <a href="http://www.webfaction.com?affiliate=bjola" target="_blank" title="Good hosting">the best shared hosting option available</a>.</li>
</ul>
<p>&nbsp;</p>
<p><a name="download"><br />
<h2>Bonus: Backup/restore script for WordPress</h2>
<p></a></p>
<p>&nbsp;</p>
<p><a href="/wp-content/uploads/wpbackup.tar.gz" title="Backup/Restore script">Here&#8217;s the script</a> that runs backups for DesignPractica and can restore a wordpress site in a single command: <a href="/wp-content/uploads/wpbackup.tar.gz" title="Backup/Restore script">[dowload]</a>. This is written in Python, simply because it&#8217;s the best language ever. You run these scripts like this.</p>
<p>Backup:<br />
<code>
<pre>
python backup.py &lt;path-to-wordpress-application-directory&gt;
</pre>
<p></code></p>
<p>This will create a time-stamped backup directory inside ./wordpress-backup/<wordpress -application-name>/ and put a compressed copy of the application directory and of the database in it.</p>
<p>Restore:<br />
<code>
<pre>
python restore.py &lt;path-to-wordpress-application-directory&gt; &lt;path-to-backup-directory&gt;
</pre>
<p></code></p>
<div class="right sidenote">
If you found this stuff useful and saved some time thanks to my article or code &#8211; you can <a href="javascript:void(0);" onclick="getElementById('beerform').submit();return false;">buy me a beer</a>! Thanks!</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="beerform">
<input type="hidden" name="cmd" value="_s-xclick"/><br />
<input type="hidden" name="hosted_button_id" value="MXJQVMYKGAMYS"/><br />
<input type="image" src="http://designpractica.com/wp-content/uploads/2011/11/beer2-150x150.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/><br />
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"/><br />
</form>
</div>
<p><strong>Note:</strong> If your WordPress site was hacked, this means there&#8217;s a vulnerability either in WordPress itself or in one of the plugins you are using. Upon restoring from backup, upgrade to all latest versions, and re-scan the site to make sure it did not get infected again. It&#8217;s generally a good idea to google for known recent vulnerabilities in WordPress plugins, and take appropriate steps &mdash; e.g. avoid affected plugins altogether, use safer alternatives, etc.</p>
<p>Also, if you are hosting your customers&#8217; WordPress sites, <strong>make sure your users do not have admin rights</strong>. This may sound harsh, but seriously, &#8220;editor&#8221; role is quite sufficient for day-to-day use.  There are good reasons why public hosting companies who support WordPress limit what plugins you may or may not install. There are good reasons not to trust users with this. If all you have is a few simple blogs and &#8220;business card&#8221; type of sites, sure &mdash; install all the experimental stuff you wish. The worst that can happen if they are hacked &mdash; you&#8217;ll lose your latest blog post or comments. But for large online stores keeping track of their customers, a hacked site may mean serious damage to credibility. If all your customers suddenly start getting spam, if their personal information is compromised, your business is be in serious trouble. If all of your customers&#8217; customers are exposed in this way, you&#8217;re dead, as long as your business is concerned.</p>
<p>Well, thanks for reading this long post-mortem. Here are a few affiliate links to the great tools I mentioned in this post. If you decide to purchase their products, do me a favour, go through these links.</p>
<ul>
<li><a href="http://www.kqzyfj.com/click-5528105-10639599" target="_blank" title="AVG Antivirus">AVG antivirus</a><img src="http://www.tqlkg.com/image-5528105-10639599" width="1" height="1" border="0"/></li>
<li><a href="http://affl.sucuri.net/?affl=f4c0cea6a31587a7a935d24071553025" target="_blank" title="Sucuri Site Scanner">Sucuri Site Scanner</a></li>
</ul>
<p></wordpress></p>
]]></content:encoded>
			<wfw:commentRss>http://designpractica.com/blog/what-to-do-when-your-website-is-hacked/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
