Re: Your IDE of choice

2009-01-07 Thread Oscar Carlsson

Sweet!

I've been looking (and I'm pretty sure it's not only me who's been
looking) for some good tutorial on how to do this.

Luckily I use OS X at home, which probably means that I can use this
without any modification... :-D

Thank you very much!

Oscar

On Wed, Jan 07, 2009 at 01:06:43PM +, Adam Stein wrote:
> 
> I have omnicomplete working (haven't used it too much yet).  I have this
> in my $HOME/.vimrc file:
> 
> --.vimrc--
> if has("autocmd")
> autocmd BufRead *.py set smartindent
> \ cinwords=if,elif,else,for,while,try,except,finally,def,class
> 
> autocmd FileType python set omnifunc=pythoncomplete#Complete
> autocmd FileType javascript set
> omnifunc=javascriptcomplete#CompleteJS
> autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
> autocmd FileType css set omnifunc=csscomplete#CompleteCSS
> endif
> 
> " Allow  to be used instead of  like other IDE's do
> " for auto-completion
> inoremap  
> --.vimrc--
> 
> All 'autocmd' lines should be single lines.
> 
> Also, I have vim starting automatically importing the Django db.  I have
> a little script (below) that will automatically find my settings.py file
> and start vim.  I do this by starting at the location of the file on the
> vim command line and working upwards in the directory structure until I
> find it:
> 
> --dvim--
> #!/packages/bin/python
> 
> """
> Start vim for Django files
> """
> 
> import os
> import sys
> 
> args = sys.argv
> 
> # Get our starting directory to look for the settings file.  If no
> # filename is given, start in the current directory
> if len(args) > 1:
> # If multiple filenames are given on the command line, we assume
> # the same Django settings apply to all
> dir = os.path.realpath(os.path.dirname(args[1]))
> else:
> dir = os.path.realpath(".")
> 
> # Start looking for the settings file, going up one directory if we
> # don't find it until we hit the top of the filesystem
> 
> while not os.path.exists(dir + "/settings.py"):
> if dir == "/":
> # We are as far as we can go and didn't find anything
> dir = None
> break
> 
> # Go up one directory
> dir = os.path.dirname(dir)
> 
> if dir != None:
> # Found the settings file
> os.putenv("PYTHONPATH", os.path.dirname(dir))
> os.putenv("DJANGO_SETTINGS_MODULE", os.path.basename(dir) +
> ".settings")
> 
> os.system("/packages/bin/vim '+python from django import db' " + \
>   " ".join(args[1:]))
> else:
> raise IOError("Django settings file not found")
> 
> sys.exit(0)
> --dvim--
> 
> I'm sure some lines are probably getting wrapped.
> 
> I only use Django on Unix/Linux so I'm guessing it would need some
> tweaking for Windows.
> 
> On Wed, 2009-01-07 at 12:26 +0100, Oscar Carlsson wrote:
> > Have you been able to make omnicomplete work with Django?
> > I haven't been able to figure it out myself, and gave up after a few
> > tries. It would be really sweet to have, since vim otherwise is a really
> > good editor.
> > 
> > Oscar
> > 
> > On Wed, Jan 07, 2009 at 12:15:22PM +1930, Santiago wrote:
> > > 
> > > i recently switched to screen + vim with omnicomplete for python and 
> > > html...
> > > 
> > > komodo edit its pretty good too
> > > 
> > > 2009/1/7 martyn <andresmartinoc...@gmail.com>:
> > > >
> > > > Hi
> > > >
> > > > http://pyrox.utp.edu.co/
> > > >
> > > > Regards
> > > >
> > > > Bye.
> > > >
> > > > On Jan 6, 9:34 am, roberto <robertomariobeni...@gmail.com> wrote:
> > > >> I tried them all (almost ... I think... at least the free ones).
> > > >> - Pyscripter is really nice but it is true, it is only for windows.
> > > >> (If it is developed with python it should be platform-independent,
> > > >> shouldn' be ?) (no support for sql queries I think)
> > > >> - Eclipse + PyDev (no good support for sql queries to relational db)
> > > >> - Ulipad (open source / excellent / very small / some issues with
> > > >> svn / no support for sql queries to db - django plugin to highlight
> > > >> templates, etc)
> > > >> - Netbeans (ex-NBPython) it is excellent (very good sql support - some
> > > >> issues with memory consume - I didn't get debugger work 100% with
> > > 

Re: Django vs. Kohana

2008-07-17 Thread Oscar Carlsson
I've never used Kohana (or CodeIgniter), but I've used both PHP and Python -
and even if Kohana is a really nice framework, Python is still a great
advantage. Python is very friendly.
And Django (totally) kicks ass :-)

Oscar

2008/7/17 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

>
>
>
> Henrik Bechmann napisaƂ(a):
> > Can anyone with experience or knowledge of both Django and Kohana (PHP
> > framework, son of CodeIgniter) list contexts in which each would be
> > most appropriate? I'm in a selection process right now with both on
> > the short list.
> >
> > Thanks!
> >
> > - Henrik
>
> Django is Python and CodeIgniter is PHP - that's the main difference.
> As for frameworks - I was using CodeIgniter, before Django. I switched
> because I wanted something with more feautres and easy to use.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: NEED HELP

2008-07-16 Thread Oscar Carlsson
Please post the code at dpaste.com, and paste the URL in the mail :-)
As Kenneth suggested, I think it looks like an indentation error, but it's
hard to detect or confirm while the mail is displayed with a non-monospaced
font.

Oscar

On Wed, Jul 16, 2008 at 7:39 AM, Kadusale, Myles <[EMAIL PROTECTED]>
wrote:

>
> Help!
>
> I am trying out Django but I get this error in my console
>
> C:\DjangoProj\UserApp>python manage.py syncdb
> Error: Couldn't install apps, because there were errors in one or more
> models:
> UserApp.UserProfile: invalid syntax (models.py, line 12)
>
>
> 
> ---
> C:\DjangoProj\UserApp\UserProfile\models.py
> 
> 
>
> 1. from django.db import models
> 2. from django.contrib.auth.models import User
> 3.
> 4. GENDER_CHOICES = (
> 5. ('M', 'Male'),
> 6. ('F', 'Female'),
> 7. )
> 8.
> 9. # Create your models here.
> 10. class UserProfile(models.Model):
> 11.user_id = models.CharField('User ID', max_length=5,
> primary_key=True)
> 12.  user_fname = models.CharField('First Name', max_length=30)
> user_lname = models.CharField('Last Name', max_length=50)
>   user_email = models.EmailField('Email Address', blank=True)
> user_gndr = models.CharField(max_length=1,
> choices=GENDER_CHOICES)
>   user_headshot = models.ImageField(upload_to='img', blank=True,
> null=True)
> user_bday = models.DateField('Birthday')
> user_uname = models.ForeignKey(User, unique=True)
>
>
>def __str__(self):
>return self.user_id
>
> 
> ---
>
>
> Thanks Myles
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: tree structured data

2008-07-13 Thread Oscar Carlsson
I believe there's a project called GeoDjango that's dealing with this very
issue, you should check it out:
http://code.djangoproject.com/wiki/GeoDjango

Oscar

On Mon, Jul 14, 2008 at 12:27 AM, MarC <[EMAIL PROTECTED]> wrote:

>
> Hello everybody,
>
> I'm trying to come up with the most django simple friendly way to store
> records in a "tree" kind of database. For instance my records are
> Beverages, Food>Fruits>Apples, Food>Vegetables>Carrots, etc . Ideally
> I'd like to be able to select records that may be categories (Food,
> Beverages or Fruits, Vegetables) as specific products/leafs (Apples,
> Carrots) and be able to fetch parents and sons from each record.
>
> I wonder if any of you have already faced this problem and have any good
> tips to share.
>
> my first tentative is:
> <<
> from django.db import models
>
> # Create your models here.
> class Food(models.Model):
>  name = models.CharField(max_length=50);
>  parents = models.ForeignKey('Food');
>  class Admin:
>pass
>  >>
>
> But I'm having trouble to create a root "Food" node with no ForeignKey
> defined or ForeignKey pointed to himself from the admin site.
>
> Any help will be very appreciated! Thanks in advance,
> MarC
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Creating a Scheduled Task

2008-07-13 Thread Oscar Carlsson
If you are on a *NIX platform (linux, freebsd, os x etc) the easiest way to
schedule a task is using cron, and writing a python script that can be run
from cron is trivial, even if you need to use django in this script.

Just put the script in your project root, and follow these instructions:
http://superjared.com/entry/django-and-crontab-best-friends/

There's plenty of documentation on how cron works, so that part you'll have
to figure out yourself (and it's really good to know) :-)

Oscar

On Sun, Jul 13, 2008 at 5:56 PM, Adam Fast <[EMAIL PROTECTED]> wrote:
>
> I'm not sure about admin integration but there are two apps out there
> that handle task scheduling.
>
> http://code.google.com/p/django-cron/
>
> http://code.google.com/p/django-jits/
>
> On Sat, Jul 12, 2008 at 9:53 AM, Chris <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I'm a newbie to Django, and I'm trying to find the best way to create
> > a recurring scheduled task. I'd like to run a script that periodically
> > downloads an RSS feed and updates records in the database. I can do
> > this "outside" Django with Cron and a script that uses the standalone
> > ORM, but is there any way to incorporate this into admin so I can see
> > what tasks are run and when?
> >
> > Thanks,
> > Chris
> >
> > >
> >
>
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Template Language Design

2008-07-13 Thread Oscar Carlsson
Well, if you really need arbitrary logic in your templates, but like the
django template syntax, you should take a look at Mako[0], but it might
require some work in your views.
But this separation of presentation (logic) and (business) logic is
intentional, and if I have understood everything correctly, this is a result
of the whole MVC/MTV design pattern. And besides, I think the philosofy
stated in the docs is pretty good:

"Philosophy

If you have a background in programming, or if you're used to languages like
PHP which mix programming code directly into HTML, you'll want to bear in
mind that the Django template system is not simply Python embedded into
HTML. This is by design: the template system is meant to express
presentation, not program logic."
But sometimes, this lack of logic is very annoying, but I think it's worth
it. And it probably means less bugs, since I can't make any strange errors
in my templates :-)

Oscar

0. http://www.makotemplates.org/

On Sun, Jul 13, 2008 at 9:01 AM, Chris <[EMAIL PROTECTED]> wrote:

>
> Just out of curiosity, is there a reason why the templating constructs
> can't evaluate arbitrary expressions? It seems terribly awkward to me
> that {% if %} can only evaluate variable names, while you need the
> separate operator {% ifequals %} to test for equality, and for some
> reason it doesn't support {% else %}.
>
> I had a very simple use case where I wanted to do something like:
>
> {% if a == 1}blah{% else %}foo{% endif %}
>
> and the closest I can get is:
>
> {% ifequal a 1 %}blah{% endifequal %}{% ifnotequal a 1 %}foo{%
> endifnotequal %}
>
> Chris
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Visualization of databases

2008-07-12 Thread Oscar Carlsson
There are a number of different toolkits that could do this for you, here
are three that looks usable:
http://code.google.com/apis/chart/
http://developer.yahoo.com/yui/charts/
http://matplotlib.sourceforge.net/

With (at least) matplotlib you could make your charts automatically in your
model, since they have python bindings.

Oscar

On Sat, Jul 12, 2008 at 7:28 PM, Xan <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> Is there any tool for visualizing database data? I mean for example,
> to build graphics like piechart, linechart, classification of database
> data in a frequency table (for example creating preaty diagrams like
> piwik [http://piwik.org/), or with R [http://www.r-project.org/], or
> gnuplot, )
>
> Thanks a lot,
> Xan.
>
> PS: I want to apply in activities done for my organization (typically
> I have a database of one class Action with the following fields:
> Title, Description, Type, DateofStart, DateofEnd, Location, ) and
> I want to classify and "draw" the actions by different type of fields)
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Advice on on a flatpage menu

2008-07-10 Thread Oscar Carlsson
Hello everyone!

I wrote a simple flatpage menu the other day (as a template tag), but I'm
not sure if this is a optimal solution - it feels a bit hackish.

Here's the code:
http://dpaste.com/hold/62194/

This is how the tag is used in a template:
{% load flatpage_menu %}{% get_flatpage_menu request %}
{{ flatpage_menu|safe }}

Have I misunderstood on how (and when) I should have converted the
request-variable, using the context given by the render-method?
Or have I overdone this? Are there any better was to do something similar?
:-)

Oscar

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: html templates - 'for' cycle without a variable

2008-07-06 Thread Oscar Carlsson
If you only need to repeat a div-tag 20 times, and don't need any data from
any model, you could always do it with javascript.

Oscar

On Fri, Jul 4, 2008 at 6:07 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Create a 20-elemnt list inside your view and set it as a context
> variable?
>
> On Jul 3, 10:21 am, antony_h <[EMAIL PROTECTED]> wrote:
> > How could I repeat my  20 times?
> > I've found how I can repeat it 5 times:
> > {% for a in 12345|make_list %}
> > 
> > {% endfor %}
> > But it's not so great for e.g. a hundred
> > Usage: my designer wants to test his layout and I don't want to create
> > a custom tag for such a simple task
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Make changes to model...

2008-07-02 Thread Oscar Carlsson
Unless you use django-evolution
(http://code.google.com/p/django-evolution/, which I don't know much
about) you have to make these changes yourself,
but usually it isn't that hard.

There is information on how to make these changes in the django book,
chapter 5:
http://djangobook.com/en/1.0/chapter05/ ("Making Changes to a Database
Schema")

Oscar

On Wed, Jul 2, 2008 at 2:49 PM, <[EMAIL PROTECTED]> wrote:

>
> Hello all,
>
> I'm using MySQL with Django, I setup my models and installed
> everything, got into the admin panel and realized I left a field out.
> I went back into my models file, added it, and it gives me an error
> because while I guess the code realized it's there, that field wasn't
> created in MySQL. Is there a way to do this, other than going in
> through phpMyAdmin to do it?
>
> Thnx,
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: memcache not used?

2008-07-01 Thread Oscar Carlsson
...you were very correct - I didn't have CacheMiddleware loaded, and when I
loaded it...
Everything worked.

Thanks for all your help! :-)

Oscar
(I feel a bit stupid, tho)

On Tue, Jul 1, 2008 at 11:10 PM, Steven Armstrong <[EMAIL PROTECTED]> wrote:

>
> Oscar Carlsson wrote on 07/01/08 19:02:
> > Heh, ops!
> >
> > That was a typo, but even after fixing it, nothing changed :(
> > (still no change in memory usage, that is)
> >
>
> Looking at your dpaste entry again it seems you haven't configured the
> cache middleware.
>
> > Here is the ZeroDivisionError, btw:
> > http://dpaste.com/60185/
> >
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.middleware.doc.XViewMiddleware',
>  'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')
>
>
>
> Try adding it in your settings.py, e.g:
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.cache.CacheMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.middleware.doc.XViewMiddleware',
> 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
> )
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: memcache not used?

2008-07-01 Thread Oscar Carlsson
I can connect to the daemon, and it's memory usage went up a bit (from 0.2%
to 0.4%)
>>> print mc.get('foo')
bar

But after restarting apache and loading the page in a browser, memcache
doesn't get any bigger. And if I restart the memcache daemon and then
restart apache again, memcache stays on 0.2% memory usage - ie, no change :(

Oscar

On Tue, Jul 1, 2008 at 9:56 PM, Steven Armstrong <[EMAIL PROTECTED]> wrote:

>
> Oscar Carlsson wrote on 07/01/08 21:48:
> > I've checked the following logs, but nothing turned up:
> > /var/log/nginx*
> > /var/log/httpd* (apache)
> >
> > Previously, when something went wrong with the app, all error messages
> > appeared in /var/log/httpd-error.log, but this time - nothing.
> >
> > This is all the output I get when I restart apache (apachectl restart):
> >
> > [Tue Jul 01 21:46:02 2008] [notice] SIGHUP received.  Attempting to
> restart
> > [Tue Jul 01 21:46:02 2008] [warn] (22)Invalid argument: Failed to enable
> the
> > 'httpready' Accept Filter
> > [Tue Jul 01 21:46:03 2008] [notice] Apache/2.2.9 (FreeBSD) DAV/2
> > mod_wsgi/2.0 Python/2.5.2 configured -- resuming normal operations
> >
> > I also removed all *.pyc after adding 'debug=1'.
>
> I believe you wont see anything on starting apache but rather when the
> server starts serving requests.
>
> Apart from that, can you connect to the memcached daemon from the python
> prompt?
>
> e.g. does something like this work?
>
> import memcache
> mc = memcache.Client(['127.0.0.1:11211'], debug=1)
> mc.set('foo', 'bar')
> print mc.get('foo')
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: memcache not used?

2008-07-01 Thread Oscar Carlsson
I've checked the following logs, but nothing turned up:
/var/log/nginx*
/var/log/httpd* (apache)

Previously, when something went wrong with the app, all error messages
appeared in /var/log/httpd-error.log, but this time - nothing.

This is all the output I get when I restart apache (apachectl restart):

[Tue Jul 01 21:46:02 2008] [notice] SIGHUP received.  Attempting to restart
[Tue Jul 01 21:46:02 2008] [warn] (22)Invalid argument: Failed to enable the
'httpready' Accept Filter
[Tue Jul 01 21:46:03 2008] [notice] Apache/2.2.9 (FreeBSD) DAV/2
mod_wsgi/2.0 Python/2.5.2 configured -- resuming normal operations

I also removed all *.pyc after adding 'debug=1'.

Oscar

On Tue, Jul 1, 2008 at 7:19 PM, Steven Armstrong <[EMAIL PROTECTED]> wrote:

>
> Oscar Carlsson wrote on 07/01/08 19:02:
> > Heh, ops!
> >
> > That was a typo, but even after fixing it, nothing changed :(
> > (still no change in memory usage, that is)
> >
> > Here is the ZeroDivisionError, btw:
> > http://dpaste.com/60185/
> >
> > Oscar
> >
>
> The python-memcached client fails silently if it encounters an error,
> e.g. can't connect to the server.
>
> You could try changing how the client is created in
> django/core/cache/backends/memcached.py
>
> from:
> self._cache = memcache.Client(server.split(';'))
>
> to:
> self._cache = memcache.Client(server.split(';'), debug=1)
>
> And see if you get some error message in the server log.
>
> hth
> cheers
> Steven
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: memcache not used?

2008-07-01 Thread Oscar Carlsson
Heh, ops!

That was a typo, but even after fixing it, nothing changed :(
(still no change in memory usage, that is)

Here is the ZeroDivisionError, btw:
http://dpaste.com/60185/

Oscar

On Tue, Jul 1, 2008 at 6:47 PM, Brian Luft <[EMAIL PROTECTED]> wrote:

>
> In your settings file you have indicated that memcached is running on
> port 112211 but your process listing shows it running on 11211.
>
> -Brian
>
> On Jul 1, 9:34 am, "Oscar Carlsson" <[EMAIL PROTECTED]> wrote:
> > Hi!
> >
> > For some reason, django doesn't seem to add anything to my memcache - the
> > process is using 0.2% RAM (seems to be the absolute minimum on my system,
> > FreeBSD 7 with 512 MByte RAM) and never starts using more memory.
> >
> > Why is this? I have no idea where to begin debug this, nothing ever shows
> up
> > in any logs :/
> >
> > This is how I've configured my django app (in settings.py):
> >
> > CACHE_BACKEND = 'memcached://127.0.0.1:112211/'
> > CACHE_MIDDLEWARE_SECONDS = 60 * 60
> > CACHE_MIDDLEWARE_KEY_PREFIX = ''
> > CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
> >
> > From ps -aux:
> > nobody 54585  0.0  0.2  3204  1240  ??  Ss6:22PM   0:00.01
> > /usr/local/bin/memcached -p 11211 -m 32 -l 127.0.0.1 -d -u nobody
> >
> > I'm using nginx as a frontend for a Apache 2.2 (with event-worker, not
> > prefork etc) using mod_wsgi and a few virtual hosts (although it
> shouldn't
> > matter?).
> >
> > I tried to use this:http://effbot.org/zone/django-memcached-view.htm,
> but
> > I end up with a division by zero exception when the view tries to
> calculate
> > the memory usage, which seems to be because memcache isn't caching
> anything.
> >
> > Anyone experienced this before, or know where to start debug?
> >
> > Oscar
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



memcache not used?

2008-07-01 Thread Oscar Carlsson
Hi!

For some reason, django doesn't seem to add anything to my memcache - the
process is using 0.2% RAM (seems to be the absolute minimum on my system,
FreeBSD 7 with 512 MByte RAM) and never starts using more memory.

Why is this? I have no idea where to begin debug this, nothing ever shows up
in any logs :/

This is how I've configured my django app (in settings.py):

CACHE_BACKEND = 'memcached://127.0.0.1:112211/'
CACHE_MIDDLEWARE_SECONDS = 60 * 60
CACHE_MIDDLEWARE_KEY_PREFIX = ''
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

>From ps -aux:
nobody 54585  0.0  0.2  3204  1240  ??  Ss6:22PM   0:00.01
/usr/local/bin/memcached -p 11211 -m 32 -l 127.0.0.1 -d -u nobody

I'm using nginx as a frontend for a Apache 2.2 (with event-worker, not
prefork etc) using mod_wsgi and a few virtual hosts (although it shouldn't
matter?).

I tried to use this: http://effbot.org/zone/django-memcached-view.htm , but
I end up with a division by zero exception when the view tries to calculate
the memory usage, which seems to be because memcache isn't caching anything.

Anyone experienced this before, or know where to start debug?

Oscar

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Thanks!!!!!!!!!!!!!!!!!

2008-06-20 Thread Oscar Carlsson
+1

Oscar

On Fri, Jun 20, 2008 at 12:52 PM, Valts Mazurs <[EMAIL PROTECTED]> wrote:

> Sure, me too :)
>
>
> On Fri, Jun 20, 2008 at 1:32 PM, chris vigelius <
> [EMAIL PROTECTED] <[EMAIL PROTECTED]>> wrote:
>
>>
>> me2...
>>
>> Am Freitag, 20. Juni 2008 05:50:13 schrieb Juan Hernandez:
>> > me 2 :D
>> >
>> > On Fri, Jun 20, 2008 at 10:42 PM, k0001 <[EMAIL PROTECTED]> wrote:
>> > > Can I jump into the "THANKS" bandwagon?
>> > >
>> > > Thanks. =)
>> > >
>> > > On Thu, Jun 19, 2008 at 11:41 PM, Gene Campbell <
>> [EMAIL PROTECTED]>
>> > >
>> > > wrote:
>> > > > Just wanted to "THANKS" for an absolutely awesome web
>> dev
>> > >
>> > > framework.
>> >
>> >
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Switched to Python2.5 now PIL has stopped working

2008-06-16 Thread Oscar Carlsson
I installed python + pil + django etc with MacPorts, and I have no problems
with PIL, whatsoever.
And you get all your custom installs in /opt/local, keeping your OS X
installation clean... :)

Oscar

On Mon, Jun 16, 2008 at 6:50 PM, Jude <[EMAIL PROTECTED]> wrote:

>
> Thanks, you've been really helpful. I followed the instructions on the
> link provided and although it hasn't fixed it I think I'm a bit closer
> to solving the problem. As you suggested, it's a jpg issue - there are
> no problems uploading .gifs
>
> I am having trouble importing PIL's _imaging module and so far am
> getting:
>
> ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/
> lib/python2.5/site-packages/PIL/_imaging.so, 2): Symbol not found:
> _jpeg_std_error
>
>
> I'll post back if/when I find out what went wrong.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Start server

2008-06-16 Thread Oscar Carlsson
No, you don't have to load everything by hand - there is another way :)

http://superjared.com/entry/django-and-crontab-best-friends/

Oscar

On Mon, Jun 16, 2008 at 11:33 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:

> On Mon, Jun 16, 2008 at 3:50 PM, Molly <[EMAIL PROTECTED]> wrote:
>
>>
>> Hey guys,
>>
>> I created an app and I am trying to launch the server through my
>> pyweb.py code since I will eventually, when this gets working be
>> putting it on a different drive for other computers with different
>> servers to use.
>>
>> My code works, but when i create a py2exe and i run it, i get an
>> error.
>>
>>
>> 
>> My pyweb.py code:
>>
>> 
>> import os
>> import sys
>> import time
>> from django.core.management import call_command
>> import threading
>> import thread
>> from django.core.management.commands.runserver import Command
>> import webbrowser
>>
>> sys.path += [r'c:\dev']
>> sys.path += [r'p:\Hazard_Inventory']
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'incidents.settings'
>>
>> #t = thread.start_new_thread(os.system, (u'C:\\Python25\\python C:\\dev
>> incidents\\manage.py runserver > nul', ))
>>
>> class RunDevServer(threading.Thread):
>>def run(self):
>>s = Command()
>>s.execute(use_reloader=False)
>>
>> def start_dev_server():
>>t = RunDevServer()
>>t.setDaemon(False)
>>t.start()
>>time.sleep(.2)
>>
>> start_dev_server()
>>
>> webbrowser.open('http://127.0.0.1:8000/admin/base/incident/add/')
>>
>>
>> 
>> The error I get:
>>
>> 
>> Exception in thread Thread-1:
>> Traceback (most recent call last):
>> File "threading.pyo", line 486, in __bootstrap_inner
>> File "pyweb.py", line 20, in run
>> File "django\core\management\base.pyo", line 81, in execute
>> File "django\utils\translation\__init__.pyo", line 73, in activate
>> File "django\utils\translation\__init__.pyo", line 43, in
>> delayed_loader
>> File "django\utils\translation\trans_real.pyo", line 211, in activate
>> File "django\utils\translation\trans_real.pyo", line 200, in
>> translation
>> File "django\utils\translation\trans_real.pyo", line 183, in _fetch
>> AttributeError: 'module' object has no attribute 'auth'
>>
>> 
>>
>> I don't see how it works before it is an exe.
>>
>> Any ideas or possibly I need to run the server a different way??
>>
>> I would really appreciate any help, thanks :)
>>
>
> Here's a blog post from someone who's been down the same road:
>
> http://www.jjude.com/index.php/archives/70
>
> Apparently you need to identify and explicitly import every Django module
> your code will need.
>
> Karen
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django HTML Editor

2008-06-14 Thread Oscar Carlsson
I would go for Textmate (haven't tried E tho) even if it costs some money -
it's a superb text editor!

There are a few plugins for VIM that are very useful (especially
http://tinyurl.com/cm4nm) for this kind of editing, but Textmate is a lot
better.

Oscar

On Sat, Jun 14, 2008 at 1:19 PM, Bradley Wright <[EMAIL PROTECTED]> wrote:

>
> On Jun 14, 7:06 am, Ngu Soon Hui <[EMAIL PROTECTED]> wrote:
> > I want a free HTML editor that is compatible with Django template's
> > syntax. I just want to edit my Django power application's HTML faster.
> > When I say compatible, I mean that the editor shouldn't screw up all
> > the Django template's tags and variables.
>
> VIM has appropriate syntax highlighting, although it's about as far
> from WYSIWYG as you can get.
>
> TextMate (or E for windows) has a very good Django Template bundle.
> Not free though.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SQLobject vs SQLAlchemy

2008-06-13 Thread Oscar Carlsson
I'm wondering - are there any performance related reasons to switch from
Django ORM to say sqlalchemy?

Why does this discussion reoccur every once in a while if there is nothing
to gain?
Are there other Good Reasons (tm) to switch?

Oscar

On Fri, Jun 13, 2008 at 8:49 AM, James Bennett <[EMAIL PROTECTED]>
wrote:

>
> On Fri, Jun 13, 2008 at 1:15 AM, Pepsi330ml <[EMAIL PROTECTED]> wrote:
> > i shall go read more about SqlObject then.
>
> If you're planning to use Django, and if you do not already have a
> very strong attachment to another ORM, consider just using the one
> that comes with Django. It will make your life easier.
>
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to mark compulsory fields in admin interface?

2008-06-06 Thread Oscar Carlsson
It's HTML - ie, the required fields are in *bold* (I'm not sure google
groups accepts inline HTML, tho).

Good luck :)

Oscar

On Fri, Jun 6, 2008 at 10:12 PM, Cliff <[EMAIL PROTECTED]> wrote:

>
> Hi Cory,
> Thanks for your reply. Can you please be more precise? I am still on
> the level of trying to understand how the Django classes are
> organized. Which file is that  tag in?
> Thanks
> Cliff
>
> On Jun 6, 3:03 pm, cory <[EMAIL PROTECTED]> wrote:
> > By default, required fields are shown in bold. Just change the
> > "required" class in your admin's media directory and you can flag
> > required fields anyway you like.
> >
> > Cory
> >
> > On Jun 5, 6:34 pm, "Cliff Liang Xuan" <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> > > Is there a way to put a sign, e.g. a start * beside the compulsory
> fields in
> > > the Django Admin interface? Imagine you have a big table accommodating
> all
> > > kinds of events from a 20 minute casual drink to a multi day
> conference. The
> > > page for programming the multi day conference will put off user who
> only
> > > wants to create a simple event such as a 20 minute casual drink if the
> only
> > > necessary fields are not flagged up. Of course, the user can just type
> in
> > > one field and click save and then follow the system's complaints, but
> that's
> > > not a decent solution if you agree.
> > > It would be even nicer if the admin page can provide a "More..." button
> so
> > > it works in the following way -- it starts with a small collection of
> fields
> > > so the user can enter all the basic information, but if he wants to add
> more
> > > details, he just need to click the "More..." button to get more
> options. I'm
> > > guessing it's probably an existing feature in Django, but only because
> I'm a
> > > new starter I haven't found a way of doing it?
> > > Many thanks,
> > > Cliff
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and Linux distros

2008-05-18 Thread Oscar Carlsson

I use OS X + (vim|mysql|svn) while developing and (FreeBSD|Gentoo) in 
production :)

The only thing I'm missing is omnicompletion for django, haven't been 
able to figure out how to do it myself :(

Oscar

JonSidnell wrote:
> Hi everyone
>
> I'm suddenly struck by the notion that I would like to be dev'ing
> Django on Linux of some flavour rather than Windows.
>
> It's been a wee while since I stuck my toes in the Linux waters, so I
> was wondering if anyone here has any recommendations for a dev machine
> setup? Due to the django host I've signed with, I'm largely stuck with
> MySQL, and don't mind using the manage.py dev server while actually
> developing. Everything else is up for grabs in my mind - distro,
> editor, desktop manager skin, whatever! Although I'm unlikely to man
> up to something like emacs or vi for code editing...
>
> What works for you?
>
> Cheers
> Jon
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Xcode as Django IDE

2008-02-14 Thread Oscar Carlsson

I mostly use textmate, but I know that (Mac)Vim with omnicompletion and
snippetsEmu is quite usable.

http://code.djangoproject.com/wiki/UsingVimWithDjango 

Oscar

On Wed, Feb 13, 2008 at 01:57:38PM -0800, zombat wrote:
> 
> Hi Djangonauts.
> 
> I was looking around for a good IDE for the Mac and have tried simple
> text editors like Smultron (http://smultron.sourceforge.net/) and full
> featured IDEs like Eclipse with PyDev but I am still not really
> satisfied.
> Simple text editors lack features like code completition or file tree
> navigation and Eclipse on the other hand is a bit slow on the Mac. So
> what do you use? Is it possible or reasonable to use Xcode (the
> "native" Mac IDE)?
> 
> Thomas
> > 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Web Development with Django: Windows vs Linux/Mac OS X

2008-02-10 Thread Oscar Carlsson
Another cool editor is Scribes ( http://scribes.sourceforge.net/ ), at
least last time I tried it. Might take some configuring, but it might be
worth it :)

On Sun, Feb 10, 2008 at 10:12:02PM +0530, Ramdas S wrote:
> I know its no replacement, but try scite editor. Its cool and is used by
> many python developers I know.
> 
> Also check these http://wiki.python.org/moin/PythonEditors
> 
> RS
> 
> On Feb 10, 2008 9:01 PM, NickJ <[EMAIL PROTECTED]> wrote:
> 
> >
> > I am a long time windows user, and have just switched to ubuntu gutsy
> > for the very reason of python and django development. Although the
> > learning curve was very steep - and i have had many hardware issues -
> > i am now much happier developing on ubuntu (I have dual boot set up,
> > but 95% of what i do can now be done on ubuntu).
> >
> > One HUGE advantage i have found is speed. I have a dell inspiron 1721
> > laptop, amd64 process, 2gig of ram blah blah, and vispa was sllw.
> > For a relevant example, the django development test server would take
> > 2 or 3 seconds to refresh; loading IDLE would take 3 or 4 seconds. On
> > ubuntu, these actions are almost instant.
> >
> > I am still missing pyscripter/editpad pro, my windows dev tools, and
> > havent found an alternative I like (vim is too weird, komodo edit
> > doesnt have an amd64 build, any suggestions?). And it has taken a LONG
> > time to get up and running. But now I think my development is faster:
> > really the only thing that is important to me.
> >
> >
> > On Feb 7, 6:49 am, Aleandro <[EMAIL PROTECTED]> wrote:
> > > Hi, I'm a Windows XP longtime user but I have also Ubuntu Linux 7.10
> > > on my dual-boot computer. I've just discovered Python and Django and I
> > > have to decide what os to use for web development with Django.
> > >
> > > In fact, while I use Ubuntu Linux on my production server, I'm really
> > > satisfied with my Windows web development environment:
> > >
> > > - gVim, TortoiseSVN, the command prompt and all major browsers at my
> > > fingertips (IE, Firefox, Opera and Safari);
> > > - Python, Django and PostgreSQL/MySQL installed in just a few simple
> > > steps;
> > > - Adobe Photoshop;
> > > - superb font rendering with cleartype and no wasted time installing
> > > new hardware.
> > >
> > > Considering that the latest trend in web development is to use UNIX
> > > based OSes (Linux or Mac OS X) also for the development side, I have a
> > > simple and direct question for you: what are the tangible
> > > disadvantages of Django web development on Windows compared with a
> > > UNIX based OS?
> > >
> > > Thanks
> > > Aleandro
> > >
> >
> 
> --~--~-~--~~~---~--~~
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com
> To unsubscribe from this group, send email to [EMAIL PROTECTED]
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en
> -~--~~~~--~~--~--~---
> 


pgpd6uQz8sLtC.pgp
Description: PGP signature


Re: Web Development with Django: Windows vs Linux/Mac OS X

2008-02-09 Thread Oscar Carlsson

Why choose one when you can have both?
I'd vote for OS X.

Nice UNIX-ness, _really_ nice fonts, superb hardware support and good
looking hardware...and with VMWare Fusion / Parallells virtualisation is
simple and fast. And Photoshop works really well is OS X :)

On Thu, Feb 07, 2008 at 12:49:27AM -0800, Aleandro wrote:
> 
> Hi, I'm a Windows XP longtime user but I have also Ubuntu Linux 7.10
> on my dual-boot computer. I've just discovered Python and Django and I
> have to decide what os to use for web development with Django.
> 
> In fact, while I use Ubuntu Linux on my production server, I'm really
> satisfied with my Windows web development environment:
> 
> - gVim, TortoiseSVN, the command prompt and all major browsers at my
> fingertips (IE, Firefox, Opera and Safari);
> - Python, Django and PostgreSQL/MySQL installed in just a few simple
> steps;
> - Adobe Photoshop;
> - superb font rendering with cleartype and no wasted time installing
> new hardware.
> 
> Considering that the latest trend in web development is to use UNIX
> based OSes (Linux or Mac OS X) also for the development side, I have a
> simple and direct question for you: what are the tangible
> disadvantages of Django web development on Windows compared with a
> UNIX based OS?
> 
> Thanks
> Aleandro
> > 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simple markup language?

2008-01-21 Thread Oscar Carlsson
Another alternative could be using BeautifulSoup to find all tags in the
data and replace all non-approved tags with nothing.

Oscar

On Mon, Jan 21, 2008 at 04:03:54PM -0700, Jeff Anderson wrote:
> If you've already looked at the regular bunch: textile, markdown, rst, 
> etc...
> And you just need minimal functionality,
> You could probable write up a small hack to do it with some regular 
> expressions. You can find things that strip html, and then you could to the 
> simple markup fairly easily after that. It shouldn't take too long to write 
> something like that.
>
> It is also possible that some of the existing things may be able to either 
> disable the extras you don't need, or you could modify them to just skip 
> the code for those features.
>
> Jeff Anderson
>
> Rob Hudson wrote:
>> Hi,
>>
>> I'm looking for something along the lines of Textile or Markdown, but
>> with very minimal features.  Does anyone know of other projects that
>> might fit these requirements?
>>
>> * Strip all HTML
>> * Only allow for simple markup (bold, italics, headers, lists, URLs or
>> auto-linking URLs)
>> * Do not allow things like images, tables, classes or styles
>>
>> Thanks,
>> Rob
>> --~--~-~--~~~---~--~~
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com
>> To unsubscribe from this group, send email to [EMAIL PROTECTED]
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en
>> -~--~~~~--~~--~--~---
>>
>>   
>
>




pgp2h4iYpYxhe.pgp
Description: PGP signature