first try for runserver command

This commit is contained in:
lxsameer 2011-05-23 00:41:54 +04:30
parent fb534782b5
commit df814d1705
1 changed files with 24 additions and 0 deletions

View File

@ -16,10 +16,14 @@
;; django plugin ;; django plugin
(require 'cl)
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Variables ;; Variables
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
(defvar project-path ""
"Project source tree path.")
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Hooks ;; Hooks
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
@ -82,7 +86,26 @@ binding for Kuso IDE django plugin"
;; (global-unset-key [menu-bar edit djangobuf]) ;; (global-unset-key [menu-bar edit djangobuf])
) )
(defun get-project-path ()
"Get the project path."
(setq project-path (read-directory-name "Project source tree: "))
)
(defun* runserver (&optional (extra ""))
"Run the project development server in a new buffer"
(interactive)
(let (params)
(if (string= project-path "")
(get-project-path)
)
(message project-path)
(setq params (concat project-path "manage.py runserver " extra))
(setq runserver-buffer (get-buffer-create "*Runserver*"))
(setq runserverp (start-process-shell-command "Runserver" runserver-buffer (concat "python " params)))
)
)
;; ---------------------------------------------------------------------- ;; ----------------------------------------------------------------------
;; Minor Modes ;; Minor Modes
;; ---------------------------------------------------------------------- ;; ----------------------------------------------------------------------
@ -112,6 +135,7 @@ GNUEmacs."
;; before deactivating mode ;; before deactivating mode
(run-hooks 'django-prerm-hook) (run-hooks 'django-prerm-hook)
(destruct-menus) (destruct-menus)
(setq project-path "")
;; after deactivating mode ;; after deactivating mode
(run-hooks 'django-postrm-hook) (run-hooks 'django-postrm-hook)
) )