Пример использования функции reverse() при построении sitemap.xml для Django

Иногда, при построении карты сайта удобно пользоваться reverse() из django.core.urlresolvers

from django.contrib.sitemaps import Sitemap
from django.core.urlresolvers import reverse
from views import root, product_detail, products_list
class RootSitemap(Sitemap):
    changefreq = "weekly"
    priority = 0.9
    def items(self):
        return [root]
    def location(self, obj):
        return reverse(obj)
class ProductDetailSitemap(Sitemap):
    changefreq = "weekly"
    priority = 0.9
    def items(self):
        return Products.objects.all()
    def location(self, obj):
        return reverse(products_list, kwargs={'product_id': obj.pk})
class ProductsListSitemap(Sitemap):
    changefreq = "weekly"
    priority = 0.5
    def items(self):
        return Pets.objects.order_by('url_id')
    def location(self, obj):
        return reverse('products_list', args=[obj.url_id])

Установка Django в виртуальное окружение на сервере с CentOS

Подключаем репозиторий EPEL(i686)

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm

Для архитектуры x86_64

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Устанавливаем python-pip

yum install -y python-pip

Обновляем pip

pip-python install --upgrade pip
Downloading/unpacking pip
  Downloading pip-1.3.1.tar.gz (247Kb): 247Kb downloaded
  Running setup.py egg_info for package pip
    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
    no previously-included directories found matching 'docs/_build/_sources'
Installing collected packages: pip
  Found existing installation: pip 0.8
    Uninstalling pip:
      Successfully uninstalled pip
  Running setup.py install for pip
    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
    no previously-included directories found matching 'docs/_build/_sources'
    Installing pip script to /usr/bin
    Installing pip-2.6 script to /usr/bin
Successfully installed pip
Cleaning up...

Читать далее Установка Django в виртуальное окружение на сервере с CentOS

Соединение point-to-point в Debian и CentOS

Пример /etc/network/interfaces в Debian

iface eth0 inet static
        address <IP_ADDR>
        netmask 255.255.255.255
        gateway <GW_IP_ADDR>
        pointopoint <GW_IP_ADDR>

Можно через ifconfig

ifconfig eth0 inet <local_ip> netmask 255.255.255.255 pointopoint <destination_ip>
ip route add default via <destination_ip>

В CentOS чуть сложнее

  1. /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE=eth0
    HWADDR=<MAC address>
    ONBOOT=yes
    BOOTPROTO=static
    SCOPE="peer "
    IPADDR=<IP_ADDR>
    NETMASK=255.255.255.255
  2. /etc/sysconfig/network-scripts/route-eth0
    ADDRESS0=0.0.0.0
    NETMASK0=0.0.0.0
    GATEWAY0=<GW_IP_ADDR>