diff options
author | Mike Crute <mcrute@gmail.com> | 2010-05-26 19:03:30 -0400 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2010-05-26 19:03:30 -0400 |
commit | 3332a4da8d3ebfbda6dca7934d01061c0132a039 (patch) | |
tree | 0e2dcfe1e6cb47df0fdef2a3555bebb9d60c4f4f | |
parent | 55dfbc79f01fedee9ef3f4a7c09bcb4ff2a5bf74 (diff) | |
download | chishop-3332a4da8d3ebfbda6dca7934d01061c0132a039.tar.bz2 chishop-3332a4da8d3ebfbda6dca7934d01061c0132a039.tar.xz chishop-3332a4da8d3ebfbda6dca7934d01061c0132a039.zip |
Adding devserver convenience command.
-rw-r--r-- | README | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | setup.py | 30 |
2 files changed, 32 insertions, 10 deletions
@@ -10,19 +10,13 @@ Install dependencies:: | |||
10 | 10 | ||
11 | $ python setup.py install | 11 | $ python setup.py install |
12 | 12 | ||
13 | Initial configuration | 13 | Initial configuration:: |
14 | --------------------- | ||
15 | :: | ||
16 | 14 | ||
17 | $ $EDITOR chishop/settings.py | 15 | $ $EDITOR chishop/settings.py |
18 | $ export DJANGO_SETTINGS_FILE="chishop.settings" | ||
19 | $ django-admin.py syncdb | ||
20 | 16 | ||
21 | Run the PyPI server | 17 | Run the PyPI server:: |
22 | ------------------- | ||
23 | :: | ||
24 | 18 | ||
25 | $ django-admin.py runserver | 19 | $ python setup.py devserver |
26 | 20 | ||
27 | Please note that ``chishop/media/dists`` has to be writable by the | 21 | Please note that ``chishop/media/dists`` has to be writable by the |
28 | user the web-server is running as. | 22 | user the web-server is running as. |
@@ -1,9 +1,35 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- |
3 | 3 | ||
4 | import os | ||
4 | import codecs | 5 | import codecs |
5 | import djangopypi | 6 | import djangopypi |
6 | from setuptools import setup, find_packages | 7 | from setuptools import setup, find_packages |
8 | from distutils.core import Command | ||
9 | from subprocess import call | ||
10 | |||
11 | |||
12 | class devserver(Command): | ||
13 | """ | ||
14 | Convenience command to sync the database and run a | ||
15 | development server. | ||
16 | |||
17 | $ python setup.py runserver | ||
18 | """ | ||
19 | |||
20 | description = "run the django development server" | ||
21 | |||
22 | # Must be overridden even though we don't need them | ||
23 | user_options = [] | ||
24 | initialize_options = finalize_options = lambda self: None | ||
25 | |||
26 | def run(self): | ||
27 | environ = os.environ.copy() | ||
28 | environ['DJANGO_SETTINGS_MODULE'] = 'chishop.settings' | ||
29 | |||
30 | call(['django-admin.py', 'syncdb'], env=environ) | ||
31 | call(['django-admin.py', 'runserver'], env=environ) | ||
32 | |||
7 | 33 | ||
8 | setup( | 34 | setup( |
9 | name='chishop', | 35 | name='chishop', |
@@ -13,7 +39,6 @@ setup( | |||
13 | author='Ask Solem', | 39 | author='Ask Solem', |
14 | author_email='askh@opera.com', | 40 | author_email='askh@opera.com', |
15 | url="http://ask.github.com/chishop", | 41 | url="http://ask.github.com/chishop", |
16 | zip_safe=False, | ||
17 | install_requires=[ | 42 | install_requires=[ |
18 | 'django>=1.0', | 43 | 'django>=1.0', |
19 | 'docutils', | 44 | 'docutils', |
@@ -22,6 +47,9 @@ setup( | |||
22 | dependency_links=[ | 47 | dependency_links=[ |
23 | 'http://bitbucket.org/ubernostrum/django-registration/downloads', | 48 | 'http://bitbucket.org/ubernostrum/django-registration/downloads', |
24 | ], | 49 | ], |
50 | cmdclass={ | ||
51 | 'devserver': devserver, | ||
52 | }, | ||
25 | classifiers=[ | 53 | classifiers=[ |
26 | "Development Status :: 3 - Alpha", | 54 | "Development Status :: 3 - Alpha", |
27 | "Environment :: Web Environment", | 55 | "Environment :: Web Environment", |