How do I install a Django snippet, in particular snippet 818 - dumpscript
, on Linux?
Update 2. The question was about Linux, but for reference I have listed the corresponding way to install dumpscript
on Windows below, e.g. for use during development. (But it can also be done the other/standard way if there are no file access restrictions.)
Update 1. This will install it for an application named "programRelease" (in a Linux command-line window, Bash shell):
cd /home/msquant/www/GoogleCodeHost/programRelease
mkdir management
touch management/__init__.py
mkdir management/commands
touch management/commands/__init__.py
wget http://www.djangosnippets.org/snippets/818/download/ --output-document=/home/msquant/818.py
cp /home/msquant/818.py management/commands/dumpscript.py
The snippet dumpscript
is now part of Django Custom Management Command Extensions but I can't install it as this is on the hosting server where I have no rights to touch the Python installation. This is the error message when running "python setup.py install" to install the command extentions:
error: could not create '/usr/lib/python2.5/site-packages/django_extensions': Permission denied
Instead I just want to install the snippet and use it.
I have tried to install it this way on the hosting server:
cd /home/msquant/
wget http://www.djangosnippets.org/snippets/818/download/ --output-document=818.py
cp /home/msquant/818.py /home/msquant/www/GoogleCodeHost/dumpscript.py
And using it this way:
cd /home/msquant/www/GoogleCodeHost
python manage.py dumpscript programRelease
Error message:
Unknown command: 'dumpscript'
Type 'manage.py help' for usage.
The built-in dumpdata
works (outputting in the JSON format):
cd /home/msquant/www/GoogleCodeHost
python manage.py dumpdata programRelease
Ref "Update 2" above:
To install on Windows (assumes EXE file wget
lives in directory D:\wget, and that the temporary directory, d:\temp2, exists):
d:
cd D:\dproj\MSQall\website\GoogleCodeHost
mkdir management
echo. > management\__init__.py
mkdir management\commands
echo. > management\commands\__init__.py
D:\wget\wget.exe http://www.djangosnippets.org/snippets/818/download/ --output-document=d:\temp2\818.py
copy d:\temp2\818.py management\commands\dumpscript.py