How to install django dippcript fragment?

How to install a Django fragment, in particular the 818 - fragmentdumpscript , on Linux?

Update 2 . The question was about Linux, but for reference, I have listed the appropriate installation method dumpscripton Windows below, for example. for use during development. (But this can also be done in a different / standard way if there are no file access restrictions.)

Update 1 . This will install it for the application named "programRelease" (in the 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 is dumpscriptnow part of Django Custom Command Command Extensions , but I can’t install it because it is hosted on a server on which I have no right to relate to installing Python. This is the error message when starting the python setup.py installation to install the command extensions:

error: could not create '/usr/lib/python2.5/site-packages/django_extensions': Permission denied

Instead, I just want to set the fragment and use it.

I tried installing 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 as follows:

cd /home/msquant/www/GoogleCodeHost
python manage.py dumpscript programRelease 

Error message:

Unknown command: 'dumpscript'
Type 'manage.py help' for usage.

The built-in works dumpdata(output in JSON format ):

cd /home/msquant/www/GoogleCodeHost
python manage.py dumpdata programRelease 

Link "Update 2" above:

For installation on Windows (it is assumed that the EXE file wgetlives in the directory D: \ wget and there is a temporary directory d: \ temp2):

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
+3
2

{appname}/management/commands/, {appname} - . Python , manage.py.

__init__.py {appname}/management/ {appname}/management/commands/, , .

(, ).

+2

djangosnippets , , .

, "" python, django_extensions; , - (, ). dumpscript.py, django_extensions ( )

, dumpscript django: -)

,

+1

Source: https://habr.com/ru/post/1720774/


All Articles