fgallina / python-django.el Goto Github PK
View Code? Open in Web Editor NEWAn Emacs package for managing Django projects.
License: GNU General Public License v3.0
An Emacs package for managing Django projects.
License: GNU General Public License v3.0
I am getting the following error
Wrong argument type stringp, nil
when running
m
+ migrate
command in the mode.
The same command works in the shell.
python manage.py migrate
Hi,
python-django.el currently does not seem to work with Django 1.7 (at least with the current beta 3) -- it shows the message "Error: End of File during parsing" instead of the directory tree. I tried this with a virtualenv -- I created a new venv, installed Django 1.6.4 in there, created a new project and app, and opened it with python-django.el -- this worked. Then I updated django to 1.7b3 and it stopped working, and when I downgraded to 1.6.4, it started working again.
I don't actually know if the issue is in python-django.el or somewhere else, but to me it looks like it's a 1.7 problem. Unfortunately my elisp skills are practically non-existent, so I can't figure out what the actual problem is.
If it is an incompatibility with python-django.el and 1.7, then what are your plans on supporting 1.7?
After migrating mi settings module to use django-configurations
opening the project buffer complains about JSON readtble error
.
Adding some initialization code to python-django-info-imports-code
seems to solve the issue.
See patxoca@add8ebb
Take a look to https://django-configurations.readthedocs.io/en/stable/patterns/#standalone-scripts for the details.
If I open a Django project with M-x python-django-open-project
, I get a list of apps that I can open and close by pressing on the folder widget, which acts as widget-button-press
.
It would be really nice if I could also expand the apps by pressing on the app name. Perhaps even should work too.
Thanks for python-django.el -- it's excellent, especially for easily jumping into a shell :).
When I try to run the analog of python manage.py cms check
after installing Django CMS, I am not able to do so because the cms
command is not found. Furthermore, I cannot include a space and check
because the mode seems to prevent that.
./manage.py: cms
Would you mind having virtualenvwrapper support built in?
This way the .dir-locals.el could reference only a name instead of a path and become more portable for us using venvwrapper.
The 'm' command in the project buffer fails with the following trace (in this for my custom command "testjs":
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
expand-file-name(nil)
(list (expand-file-name python-django-project-root) (expand-file-name "../" python-django-project-root))
(mapconcat (quote identity) (list (expand-file-name python-django-project-root) (expand-file-name "../" python-django-project-root)) path-separator)
(let* ((process-environment (python-shell-calculate-process-environment)) (pythonpath (getenv "PYTHONPATH")) (project-pythonpath (mapconcat (quote identity) (list (expand-file-name python-django-project-root) (expand-file-name "../" python-django-project-root)) path-separator))) (setenv "PYTHONPATH" (if (not pythonpath) project-pythonpath (format "%s%s%s" pythonpath path-separator project-pythonpath))) (setenv "DJANGO_SETTINGS_MODULE" python-django-project-settings) process-environment)
python-django-info-calculate-process-environment()
python-django--help-get("testjs")
python-django-help("testjs")
python-django-mgmt-list-command-args("testjs")
#[nil "\305\306�\"\210\307 !\210\310\n!�\311\304!\210\312\211�\207" [setup-hook current-buffer command minibuffer-completion-table hippie-expand-try-functions-list remove-hook minibuffer-setup-hook python-util-clone-local-variables python-django-mgmt-list-command-args make-local-variable (python-django-minibuffer-try-complete-args python-django-minibuffer-try-complete-filenames)] 3]()
read-from-minibuffer("./manage.py testjs (args): " nil (keymap (remap keymap (scroll-other-window-down . python-django-minibuffer-scroll-help-window-down) (scroll-other-window . python-django-minibuffer-scroll-help-window)) (9 . hippie-expand) keymap (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "
" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . abort-recursive-edit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-history-element) (next . next-history-element) (27 keymap (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))))
python-django-minibuffer-read-command-args("testjs")
(list (setq command (python-django-minibuffer-read-command t)) (python-django-minibuffer-read-command-args command))
call-interactively(python-django-mgmt-run-command nil nil)
Looks like python-django-project-root is nil for some reason, even though it looks fine when I evaluate it's value in the project buffer.
It may be that this started happening after upgrading to Emacs 24.4. I am using latest python-django from Marmelade (version 20140614.2014).
I'm having trouble with Emacs 23.3, I have your python.el for emacs 23.3
M-x python-django-mode and a buffer with a template loaded complains:
"""
Symbol's function definition is void: nil
"""
Anywork arounds?
Cheers,
if (setq python-shell-interpreter "ipython")
.
Each time I try calling a management command there's just this message that no commands were found:
python-django-mgmt-list-commands: Search failed: "Available subcommands:
"
With python-shell-interpreter
unset, c s s
opens an ipython prompt as desired, but non-django buffers start a regular python prompt.
I'm running emacs 24.5.1 and IPython 4.0.1.
The same as #3
I have a mature Django project that I'm trying to use with python-django.el. I'm a complete newbie at Emacs, coming from a long history with Vim, so this might be more easily debuggable than I realize. Here's the problem:
Django Version: 1.4.2
Project: ~/src/pp/pp.hg/
Settings: settings
Virtualenv: /home/aron/.virtualenvs/pp
An error occurred retrieving project information.
Check your project settings and try again:
Current values:
+ python-django-project-root: ~/src/pp/pp.hg/
+ python-django-project-settings: settings
+ python-shell-interpreter: python
- found in /home/aron/.virtualenvs/pp/bin/python
Error: Wrong type argument: listp, 17
I tested with a simpler project and that worked fine, and I also tested with this project and an empty settings.py, and that worked fine. Do you have suggestions for how I can track down the problem?
See this blog post for a detailed quick start: http://from-the-cloud.com/en/emacs/2013/01/28_emacs-as-a-django-ide-with-python-djangoel.html
The above URL has been taken over by a domain squatter.
After creating a new app with c-o-s-a , I am asked if I want to move the folder.
App created in x/y/z/. Do you want to move it? (y or n)
y -> same directory: error in process sentinel: file is a directory.
y-> different empty directory: error in process sentinel: Renaming: No such file or directory.
First thanks for the great app.
I used to M-x pdb; python manage.py runserver 0.0.0.0:8000
Now, to restart the server with python-django, C-x j; m; runserver; 0.0.0.0:8000; which is quite a more work.
Is there an easier way to run management commands (such as 'run last command') ?
It would be great to exclude the emacs temp files (*~) in the main directory listing.
The json-read-from-string in python-django-info-get-version fails if settings.py writes to stdout or stderr. Maybe very uncommon to have settings print, but one of the ones here does. :-(
There's probably an elegant solution, but my tired mind can't see it now. Redirect sys.stdout and sys.stderr to os.devnull before importing settings, then reset them after? That's the only thing I've come up with, other than hacking the print statements out of the troublesome settings.py -- which won't help the next poor soul who can't figure out why python-django-open-project isn't working.
Hi,
I have several projects using virtualenv, how can I make the python environment setup automatically while switching projects?
Thanks :)
Hello.
I got this messages:
Django Version: 1.4.5
Project: /usr/home/jeltoesolnce/data/projects/shumbely_com
Settings: shumbely_com.settings
Virtualenv: None
An error occurred retrieving project information.
Check your project settings and try again:
Current values:
Error: JSON readtable error
django-rules (https://github.com/dfunckt/django-rules/) recommends loading the packages with
INSTALLED_APPS = (
'rules.apps.AutodiscoverRulesConfig',
)
which leads to an ImportError on running python-django-open-project
Details:
Error executing: /home/fritz/.pyvenvs/intranet/bin/python -c "
from __future__ import print_function
import os
import sys
from os.path import dirname, abspath
stdout = sys.stdout; stderr = sys.stderr
sys.stdout = sys.stderr = open(os.devnull, 'w')
from django.conf import settings
# Try to import json really hard
try:
import json
except ImportError:
from django.utils import simplejson as json
# Force settings loading so all output is sent to devnull.
settings.DEBUG
sys.stdout = stdout; sys.stderr = stderr
app_paths = {}
for app in settings.INSTALLED_APPS:
mod = __import__(app)
if '.' in app:
for sub in app.split('.')[1:]:
mod = getattr(mod, sub)
app_paths[app] = dirname(abspath(mod.__file__))
print(json.dumps(app_paths), end='')"
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 20, in <module>
ImportError: No module named 'rules.apps.AutodiscoverRulesConfig'; 'rules.apps' is not a package
I'm not quite sure if this is good practice on django-rules' part or not, but would appreciate your help if there's an easy solution.
For the time being, I use a dirty hack
"app_paths = {}\n"
"for app in settings.INSTALLED_APPS:\n"
" if 'rules' in app.split('.'):\n"
" app = 'rules'\n"
" ..."
Regards
I installed Emacs 27.0.50 recently and noticed that the menu in the Python-Django mode is not populated. The mode seems to be working, but the toolbar menu is empty.
I think this would be a nice feature to get tab-completion, and I can't imagine this being too difficult since the default run-python
command in emacs has tab-completion.
If someone knows better than I, please comment.
(How do I mark this as an enhancement?)
I'm having an issue getting this module working with my django setup. I work on a relatively mature project so we may have an unusual directory structure. Essentially, we have...
/apps
/apps/django <-- manage.py
/apps/django/buildbox <-- settings.py
/apps/django/apps/
/apps/django/apps/[other sub-apps]
...The error I'm getting is...
Django Version: 1.5
Project: ~/work/GITDIRS/apps/django/buildbox/
Settings: buildbox.settings
Virtualenv: None
An error occurred retrieving project information.
Check your project settings and try again:
Current values:
Error: End of file during parsing
Any ideas on what's going wrong? My apologies if I've missed something obvious.
App folders in the project folder are not displayed. Am I doing something wrong?
Project folder is set properly, also virtual environment.
python-django: 20150822.404
emacs: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
of 2017-09-22, modified by Debian
.emacs:
(require 'django-mode)
(require 'python-django)
(global-set-key (kbd "C-x j") 'python-django-open-project)
(setq python-shell-virtualenv-path "/wd/django_test/django_course_1/env1")/wd/django_test/django_course_1/one")
(add-to-list 'load-path "
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.