Django Projects : Allows you to use django management commands from within vim
script karma |
Rating 15/6,
Downloaded by 780 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Gregor Müllegger |
|
script type |
utility |
|
description |
Author: Gregor Müllegger <gregor@muellegger.de>
Version: 0.1.0
Description:
Use the script to run simple django specific tasks. You can run management
commands from in vim.
Usage:
When you have specified all your django projects you can now tell the script
that you want now to work with one of them. Let's expect you want to work
with your 'fancyblog' project.
At first you have to initalize this project:
:DjangoInit fancyblog
Now you can use all the cool commands to work with your project. Use
`:DjangoManage <command>` to execute a command with your manage.py file.
:DjangoManage syncdb
Use the `:DjangoTerminalManage <command>` command to execute a manage.py
command in an external terminal to free the vim command line for new
commands. This can be used to run django's development server from within
vim.
Configuration:
There are a few global variables you can change to fit the script your
preferences:
g:django_terminal_program
Set this variable to a terminal programm which shall execute the commands
in :DjangoTerminalManage. Default is 'xterm -e'.
Shortcuts:
There are already shortcuts for every builtin command to prevent you from
performing too many keystrokes:
:DjangoAdminindex
:DjangoCleanup
:DjangoCompileMessages
:DjangoCreateCachetable
:DjangoCreateSuperuser
:DjangoDBShell
:DjangoDiffsettings
:DjangoDumpdata
:DjangoFlush
:DjangoHelp command
:DjangoInspectDB
:DjangoLoaddata
:DjangoMakeMessages
:DjangoReset appname
:DjangoRunfcgi
:DjangoRunserver
:DjangoShell
:DjangoSql
:DjangoSqlall
:DjangoSqlclear
:DjangoSqlcustom
:DjangoSqlflush
:DjangoSqlindexes
:DjangoSqlinitialdata
:DjangoSqlreset
:DjangoSqlsequencereset
:DjangoStartapp newappname
:DjangoSyncdb
:DjangoTest [appnames]
:DjangoTestserver
:DjangoValidate
You can also use the commands from the django-commands-extension app if you
have installed it.
:DjangoCreateapp
:DjangoCreatecommand
:DjangoCreatejobs
:DjangoDescribeform
:DjangoDumpscript
:DjangoExportemails
:DjangoGenerateSecretKey
:DjangoGraphmodels
:DjangoPasswd
:DjangoPrintUserForSession
:DjangoResetDB
:DjangoRunjob
:DjangoRunjobs
:DjangoRunprofile
:DjangoRunscript
:DjangoRunserverPlus
:DjangoSetfakepasswords
:DjangoShellPlus
:DjangoShowurls
:DjangoSqldiff |
|
install details |
Requirements:
The script will only work on a unix-like system.
Installation:
Put this file (django_projects.vim) in your plugin directory and tell the
script what django projects you are working on.
To install a single django project use the g:DjangoInstall() function. Put a
lines similar to the following in your vimrc file:
call g:DjangoInstall('myproject', '/home/username/projects/myproject/', 'settings', 'manage.py', ['/usr/local/pythonlibs', 'apps/'], '.')
The arguments mean the following things:
1. argument (name): This is the projects name. It is used with the DjangoInit
command to tell the script on which project you work on.
2. argument (project root): This should be an absolute path to your
project. It is used to complete relative paths in the `manage_file`,
`paths` and `cd` argument. This argument must end with a slash.
3. argument (settings module): Specify here the name of your settings
module. This value is used to set the $DJANGO_SETTINGS_MODULE variable.
4. argument (manage.py file): Specify here the path of your manage.py
file. The project root path is prepended to this argument if a relative
path is given (e.g. the argument does not start with '/')
5. argument (python paths): This argument must be a list of strings. The
script will add these paths to your sys.path variable. If a path is
relative, the project root argument will be prepended.
6. argument (cd): Specify a directory in which the script will jump while
calling g:DjangoInit('myproject'). If not specified (e.g. it is an empty
string) no cd is performed.
Note: Maybe you need to include the source of this file into your .vimrc
(if the plugin is loaded after your g:DjangoInstall() calls). The simplest
way to do this is to put this line right before your g:DjangoInstall
calls:
source ~/.vim/plugin/django_projects.vim |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.188.152.124
|