Django

http://www.djangoproject.com/

tar xzvf Django-0.96.1.tar.gz
cd Django-0.96.1
python setup.py install
C:\python25;C:\python25\Scripts;

http://sourceforge.net/projects/mysql-python

wget http://downloads.sourceforge.net/mysql-python/MySQL-python-1.2.2.tar.gz?modtime=1172959928&big_mirror=0
tar xzvf MySQL-python-1.2.2.tar.gz 
python setup.py build
sh: mysql_config: command not found
mysql_config = /usr/local/mysql5/bin/mysql_config 
In file included from /usr/local/mysql5/include/mysql/mysql.h:47,
                 from _mysql.c:40:
/usr/include/sys/types.h:92: error: duplicate 'unsigned'
/usr/include/sys/types.h:92: error: two or more data types in declaration  specifiers
In file included from /usr/local/mysql5/include/mysql/mysql.h:47,
                from _mysql.c:40:
/usr/include/sys/types.h:92: error: duplicate 'unsigned'
/usr/include/sys/types.h:92: error: two or more data types in declaration specifiers
lipo: can't open input file: /var/tmp//ccGIog3v.out (No such file or directory)
error: command 'gcc' failed with exit status 1
#ifndef uint                                                                                        
#define uint unsigned int                                                                           
#endif                                                                                              
ld: warning in /usr/local/mysql5/lib/mysql/libmysqlclient_r.dylib, file is not  of required architecture
python setup.py install
python
>>>import MySQLdb

Problems in building 1.2.2 on Mac OS 10.5

http://initd.org/software/initd/psycopg

wget http://www.zope.org/Members/fog/psycopg/1.1.6/psycopg-1.1.6.tar.gz
tar xzvf psycopg-1.1.6.tar.gz 

http://www.stickpeople.com/projects/python/psycopg/

wget http://initd.org/pub/software/psycopg/psycopg2-2.0.6.tar.gz 
tar xzvf psycopg2-2.0.6.tar.gz 
cd psycopg2-2.0.6
python setup.py build
warning: /bin/sh: pg_config: command not found
./psycopg/connection.h:27:22: error: libpq-fe.h: No such file or directory
pg_config=/usr/local/pgsql/bin/pg_config
ld: warning in /usr/local/pgsql/lib/libpq.dylib, file is not of required architecture
python setup.py install
python
>>>import psycopg2 
django-admin.py startproject TestDjango

PyDev? TestDjango?

manage.py startapp testapp

TestDjango?

class Book(models.Model):
   isbn = models.CharField(blank=True,maxlength=100)
   author = models.CharField(blank=False,maxlength=100)
   title = models.CharField(blank=False,maxlength=100)
   price = models.FloatField(max_digits=8,decimal_places=2)

DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'hotedb'
DATABASE_USER = 'root'
DATABASE_PASSWORD = 'hogepass'
DATABASE_HOST = ''
DATABASE_PORT = ''
TIME_ZONE = 'Japan'
LANGUAGE_CODE = 'ja'
INSTALLED_APPS = (
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.sites',
   'django.contrib.admin',
   'TestDjango.testapp',
)
c:\MyProject\python\TestDjango>manage.py syncdb
Creating table auth_message
Creating table auth_group
Creating table auth_user
Creating table auth_permission
Creating table django_content_type
Creating table django_session
Creating table django_site 
Creating table testapp_book

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes <<
Username: admin <<
E-mail address: hoge@hoge.com <<
Password: hogepass <<
Password (again): hogepass <<
Superuser created successfully.
Installing index for auth.Message model
Installing index for auth.Permission model
Loading 'initial_data' fixtures...
No fixtures found.
python manage.py runserver
python manage.py runserver 0.0.0.0:8000
http://localhost:8000/

manage.py

python manage.py syncdb
python manage.py shell

TestDjango?

TIPS

__str__

TemplateDoesNotExist? at /admin/

cp -R django/contrib/admin/media /Library/Python/2.5/site-packages/django/contrib/admin
cp -R django/contrib/admin/template /Library/Python/2.5/site-packages/django/contrib/admin




トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS