<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: django + vim</title>
	<atom:link href="http://blog.fluther.com/django-vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fluther.com/django-vim/</link>
	<description>Tapping and Collecting</description>
	<lastBuildDate>Fri, 20 Jan 2012 00:29:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
	<item>
		<title>By: VIM for python programming &#124; Programming Mate</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-18118</link>
		<dc:creator>VIM for python programming &#124; Programming Mate</dc:creator>
		<pubDate>Mon, 12 Dec 2011 21:06:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-18118</guid>
		<description>[...] Django + VIM Tags: ide, python, vim [...]</description>
		<content:encoded><![CDATA[<p>[…] Django + VIM Tags: ide, python, vim […]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: h1n1-al</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-12799</link>
		<dc:creator>h1n1-al</dc:creator>
		<pubDate>Tue, 05 Jul 2011 04:05:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-12799</guid>
		<description>I made a bash script that search the settings.py folder and add it to the PYTHONPATH and defines DJANGO_SETTINGS_MODULE. If some one has some suggestions to improve the script, plase let me know. http://h1n1-al.blogspot.com/2011/07/autocompletado-de-django-en-vim.html You only need to add the script to a bin path.</description>
		<content:encoded><![CDATA[<p>I made a bash script that search the settings.py folder and add it to the PYTHONPATH and defines DJANGO_SETTINGS_MODULE. If some one has some suggestions to improve the script, plase let me know. <a href="http://h1n1-al.blogspot.com/2011/07/autocompletado-de-django-en-vim.html" rel="nofollow">http://h1n1-al.blogspot.com/2011/07/autocompletado-de-django-en-vim.html</a> You only need to add the script to a bin path.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: katt</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-9359</link>
		<dc:creator>katt</dc:creator>
		<pubDate>Sun, 13 Mar 2011 18:09:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-9359</guid>
		<description>Oh, didn&#039;t know i had to set the PYTHONPATH for the shell environment.
So I and now it works! Great guide!</description>
		<content:encoded><![CDATA[<p>Oh, didn’t know i had to set the PYTHONPATH for the shell environment.<br />
So I and now it works! Great guide!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: katt</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-9357</link>
		<dc:creator>katt</dc:creator>
		<pubDate>Sun, 13 Mar 2011 17:13:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-9357</guid>
		<description>I can&#039;t get this going. Even if I don&#039;t use the script, but just run:
$ DJANGO_SETTINGS_MODULE=mysite.settings vim
and in vim:
:python from django import db
I still get
...

raise ImportError(&quot;Could not import settings &#039;%s&#039; (Is it on sys.path? Does it have syntax errors?): %s&quot; % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings &#039;mysite.settings&#039; (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings

----
I can run
$ python manage.py shell --settings=mysite.settings
and the shell runs just fine. Any ideas?

I&#039;m on Python 2.6.6, Django 1.2.3 and Ubuntu 10.10 by the way</description>
		<content:encoded><![CDATA[<p>I can’t get this going. Even if I don’t use the script, but just run:<br />
$ DJANGO_SETTINGS_MODULE=mysite.settings vim<br />
and in vim:<br />
:python from django import db<br />
I still get<br />
…</p>
<p>raise ImportError(“Could not import settings ‘%s’ (Is it on sys.path? Does it have syntax errors?): %s” % (self.SETTINGS_MODULE, e))<br />
ImportError: Could not import settings ‘mysite.settings’ (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings</p>
<p>—-<br />
I can run<br />
$ python manage.py shell –settings=mysite.settings<br />
and the shell runs just fine. Any ideas?</p>
<p>I’m on Python 2.6.6, Django 1.2.3 and Ubuntu 10.10 by the way</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay De Lanoy</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-5642</link>
		<dc:creator>Jay De Lanoy</dc:creator>
		<pubDate>Fri, 22 Oct 2010 15:35:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-5642</guid>
		<description>@James:

I don&#039;t know if you&#039;ll see this at this point, but since this page is still linked to by the Django wiki, I figure it&#039;s worth spelling things out here in the comments.

I&#039;m guessing that you have screwed up the quotes, as alluded to by chris berkholtz as a potential issue.

In other words, are you using single quotes around what you&#039;re setting PROJECT to? That&#039;s what your error suggests to me.

Instead, use backquotes (generally, the unshifted tilde, aka the key next to one on standard us-querty layouts). The backquote tells the shell, &quot;Please replace this with the standard output of the content within.&quot; Since the command you&#039;re passing is python w/ the -c option, it&#039;ll execute the arg to -c as a script. This makes *exactly* how one uses quotes throughout all this a bit complex, and is an obvious potential pitfall for those who are newer to bash scripting to fall into.

Another one that I&#039;ve run into along the way is making sure that the parent directory of my django projects is included in my PYTHONPATH.

BTW, my suggested script is more akin to Don&#039;s. Franck&#039;s will fail if the user isn&#039;t calling it from the project directory, &amp; I prefer to be able to use it from the app directories as well.

My directory structure is that I always put projects under site folders which are under my src directory. So, the following works for me:

#!/bin/bash
PROJECT=`python -c &quot;import os;print os.getcwd().partition(&#039;src&#039;)[2].split(os.sep)[2]&quot;`
DJANGO_SETTINGS_MODULE=$PROJECT.settings vim

The PROJECT line&#039;s quotes are backtick, double, single, single, double, backtick, for those attempting to play along at home. Adjust the tuple indices &amp; the arg to partition as appropriate for one&#039;s own directory structure.</description>
		<content:encoded><![CDATA[<p>@James:</p>
<p>I don’t know if you’ll see this at this point, but since this page is still linked to by the Django wiki, I figure it’s worth spelling things out here in the comments.</p>
<p>I’m guessing that you have screwed up the quotes, as alluded to by chris berkholtz as a potential issue.</p>
<p>In other words, are you using single quotes around what you’re setting PROJECT to? That’s what your error suggests to me.</p>
<p>Instead, use backquotes (generally, the unshifted tilde, aka the key next to one on standard us-querty layouts). The backquote tells the shell, “Please replace this with the standard output of the content within.” Since the command you’re passing is python w/ the –c option, it’ll execute the arg to –c as a script. This makes *exactly* how one uses quotes throughout all this a bit complex, and is an obvious potential pitfall for those who are newer to bash scripting to fall into.</p>
<p>Another one that I’ve run into along the way is making sure that the parent directory of my django projects is included in my PYTHONPATH.</p>
<p>BTW, my suggested script is more akin to Don’s. Franck’s will fail if the user isn’t calling it from the project directory, &amp; I prefer to be able to use it from the app directories as well.</p>
<p>My directory structure is that I always put projects under site folders which are under my src directory. So, the following works for me:</p>
<p>#!/bin/bash<br />
PROJECT=‘python –c “import os;print os.getcwd().partition(‘src’)[2].split(os.sep)[2]”‘<br />
DJANGO_SETTINGS_MODULE=$PROJECT.settings vim</p>
<p>The PROJECT line’s quotes are backtick, double, single, single, double, backtick, for those attempting to play along at home. Adjust the tuple indices &amp; the arg to partition as appropriate for one’s own directory structure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-5164</link>
		<dc:creator>James</dc:creator>
		<pubDate>Thu, 30 Sep 2010 01:31:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-5164</guid>
		<description>Shoot I meant to say when I run the bash script and try typing :python from django import db in MacVim</description>
		<content:encoded><![CDATA[<p>Shoot I meant to say when I run the bash script and try typing :python from django import db in MacVim</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-5163</link>
		<dc:creator>James</dc:creator>
		<pubDate>Thu, 30 Sep 2010 01:30:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-5163</guid>
		<description>@Franck

When I try to run that script I get:
ImportError: Could not import settings &#039;python –c &quot;import os; print os.path.base
name(os.getcwd())&quot;.settings&#039; (Is it on sys.path? Does it have syntax errors?): No module named python –c &quot;import os; print os.path.basename(os.getcwd())&quot;.settings

Any suggestions?</description>
		<content:encoded><![CDATA[<p>@Franck</p>
<p>When I try to run that script I get:<br />
ImportError: Could not import settings ‘python –c “import os; print os.path.base<br />
name(os.getcwd())”.settings’ (Is it on sys.path? Does it have syntax errors?): No module named python –c “import os; print os.path.basename(os.getcwd())”.settings</p>
<p>Any suggestions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chris berkholtz</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-3374</link>
		<dc:creator>chris berkholtz</dc:creator>
		<pubDate>Mon, 17 May 2010 18:47:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-3374</guid>
		<description>The code in the above works but you have to retype the quotes, they are fancy quotes, bash likes ugly ones.</description>
		<content:encoded><![CDATA[<p>The code in the above works but you have to retype the quotes, they are fancy quotes, bash likes ugly ones.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nagy Viktor (V): Vim actually seems to be quite nice for Python/Django development</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-370</link>
		<dc:creator>Nagy Viktor (V): Vim actually seems to be quite nice for Python/Django development</dc:creator>
		<pubDate>Mon, 14 Sep 2009 23:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-370</guid>
		<description>[...] omnicomplete [...]</description>
		<content:encoded><![CDATA[<p>[…] omnicomplete […]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nagy Viktor (V): Vim actually seems to be quite nice for Python/Django development</title>
		<link>http://blog.fluther.com/django-vim/comment-page-1/#comment-371</link>
		<dc:creator>Nagy Viktor (V): Vim actually seems to be quite nice for Python/Django development</dc:creator>
		<pubDate>Mon, 14 Sep 2009 23:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fluther.com/blog/?p=213#comment-371</guid>
		<description>[...] omnicomplete [...]</description>
		<content:encoded><![CDATA[<p>[…] omnicomplete […]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.237 seconds -->

