Уведомления

Группа в Telegram: @pythonsu

#1 Сен. 28, 2007 17:30:01

SOmni
От:
Зарегистрирован: 2007-09-28
Сообщения: 2
Репутация: +  0  -
Профиль   Отправить e-mail  

Настройка django

Привет всем.
Вводная:
uname -a
Linux openplat 2.6.18-5-686 #1 SMP Thu Aug 30 02:19:07 UTC 2007 i686 GNU/Linux

dpkg -l | grep python
ii libapache2-mod-python 3.2.10-4 Apache 2 module that embeds Python within th
ii python 2.4.4-2 An interactive high-level object-oriented la
ii python-all 2.4.4-2 Package depending on all supported Python ru
ii python-all-dev 2.4.4-2 Package depending on all supported Python de
ii python-central 0.5.12 register and build utility for Python packag
ii python-dev 2.4.4-2 Header files and a static library for Python
ii python-django 0.95.1-1 A high-level Python Web framework
ii python-egenix-mxdatetime 2.0.6-4 date and time handling routines for Python
ii python-egenix-mxtools 2.0.6-4 collection of new builtins for Python
ii python-minimal 2.4.4-2 A minimal subset of the Python language (def
ii python-newt 0.52.2-10 A NEWT module for Python
ii python-psycopg2 2.0.5.1-6 Python module for PostgreSQL
ii python-selinux 1.32-3 Python bindings to SELinux shared libraries
ii python-semanage 1.8-1 Python bindings for SELinux policy manipula
ii python-support 0.5.6 automated rebuilding support for python modu
ii python2.4 2.4.4-3 An interactive high-level object-oriented la
ii python2.4-dev 2.4.4-3 Header files and a static library for Python
ii python2.4-minimal 2.4.4-3 A minimal subset of the Python language (ver
————-
Сразу скажу, что питон вижу впервые, очень захотелось попробовать. Поставил апач2, питон, покопался на сайтах, настроил. Проверил работу питона на примере из инета же:
def index():
out = “<html><body><form method='POST' action='index_2.py/process'>”
out = out + “What is your favorite color?<br>”
out = out + “<input type='text' name='color'><br>”
out = out + “What time did you wake up this morning?<br>”
out = out + “<input type='text' name='waket'><br>”
out = out + “What is your favorite language?<br>”
out = out + “<select name='flang'><option>Python</option></select><br>”
out = out + “<input type='submit' value='Process'>”
out = out + “</form></body></html>”
return out
def process ( color, waket, flang ):
return “Your favorite color is ” + color + “, you woke up at ” + waket + “ and you like ” + flang + “.”

Работает. Поставил django, выполнил инструкции из книги, дошел до проверки примера (из книги же)
from django.http import HttpResponse
import datetime

def current_datetime(request):
now = datetime.datetime.now()
html = “<html><body>It is now %s.</body></html>” % now
return HttpResponse(html)

не работает, пишет, что страница не найдена. Права на файл не менял, так что не в этом дело. Думаю, что-то криво у меня в настройках апача, ибо опыта в этом немного, в логах ошибок нет. Прошу сильно не пинать, если настройки нубские :)
————————
кусок apache2.conf
<Files *.py>
AddHandler python-program .py
PythonHandler mod_python.publisher
# AddHandler mod_python .psp
# PythonHandler mod_python.psp
Order allow,deny
Allow from all
Options +ExecCGI
</Files>

конфиг хоста в /etc/apache2/sites-enabled/…
#NameVirtualHost *
<VirtualHost *:80>
ServerName openplat.homelinux.com
ServerAlias openplat.ru
ServerAdmin openpays@gmail.com

DocumentRoot /home/evgeny/www/index
<Directory /home/evgeny/www/index>
Options FollowSymLinks MultiViews -Indexes
AllowOverride All
Order allow,deny
allow from all
DirectoryIndex index.php
</Directory>

ErrorLog /var/log/apache2/evgeny.log
LogLevel warn
ServerSignature On
</VirtualHost>

Сама страница (работает, когда я не сплю, т.к. сервер домашний :))
http://openplat.homelinux.com/
—-
Заранее спасибо!



Отредактировано (Сен. 28, 2007 17:31:42)

Офлайн

#2 Окт. 2, 2007 09:59:08

SOmni
От:
Зарегистрирован: 2007-09-28
Сообщения: 2
Репутация: +  0  -
Профиль   Отправить e-mail  

Настройка django

Да, всё дело в моем неверном представлении о сути джанги. Буду дальше смотреть, спасибо.



Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version