Custom Commands?

2013-04-10 Thread Mark Lybrand
I am at a loss how to get custom commands working in my Django project.

I am on Windows 7, running Python 2.7.3, Django 1.4.5.  When I try to make 
my "hello world" command, I get an unknown command error.

I have the following structure:

│   manage.py
│
├───mysite
│   │   settings.py
│   │   settings.pyc
│   │   urls.py
│   │   urls.pyc
│   │   wsgi.py
│   │   wsgi.pyc
│   │   __init__.py
│   │   __init__.pyc
│   │
│   └───management
│   │   __init__.py
│   │
│   └───commands
│   x.py
│   __init__.py


And this is the code of my command:

from optparse import make_option
from django.core.management.base import BaseCommand, CommandError

class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--long', '-l', dest='long',
help='Help for the long options'),
)
help = 'Help text goes here'

def handle(self, **options):
 print "This is a command"

When I run

python manage.py x

I get:

Unknown command: 'x'
Type 'manage.py help' for usage.

Where should begin looking to troubleshoot this issue?

Thanks in advance...

Mark :)


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Custom Commands?

2013-04-11 Thread Mark Lybrand
So, you have a management/commands structure in each app of your project
and not in the main "app" (or whatever that thing is called).  Here is the
structure of my whole project thus far (I had just shown the part that I
thought was important).  As you can see I already had an app and the app is
included in the INSTALLED_APPS of settings.py:

│   manage.py
│
├───mysite
│   │   settings.py
│   │   settings.pyc
│   │   urls.py
│   │   urls.pyc
│   │   wsgi.py
│   │   wsgi.pyc
│   │   __init__.py
│   │   __init__.pyc
│   │
│   └───management
│   │   __init__.py
│   │
│   └───commands
│   x.py
│   __init__.py
│
├───mytemplates
│   ├───admin
│   │   base_site.html
│   │   index.html
│   │
│   └───polls
│   detail.html
│   index.html
│   results.html
│
└───polls
admin.py
admin.pyc
models.py
models.pyc
tests.py
urls.py
urls.pyc
views.py
views.pyc
__init__.py
__init__.pyc



On Wed, Apr 10, 2013 at 11:54 PM, Andrey Kostakov  wrote:

> For first step you need create application, "manage.py startapp myapp".
> 'management' folder should be located in your application folder. And
> don't forget add application in INSTALLED_APPS in your settings.py
> (INSTALLED_APPS = ('myapp', ))
>
> On Thu, Apr 11, 2013 at 4:52 AM, Mark Lybrand  wrote:
> > I am at a loss how to get custom commands working in my Django project.
> >
> > I am on Windows 7, running Python 2.7.3, Django 1.4.5.  When I try to
> make
> > my "hello world" command, I get an unknown command error.
> >
> > I have the following structure:
> >
> > │   manage.py
> > │
> > ├───mysite
> > │   │   settings.py
> > │   │   settings.pyc
> > │   │   urls.py
> > │   │   urls.pyc
> > │   │   wsgi.py
> > │   │   wsgi.pyc
> > │   │   __init__.py
> > │   │   __init__.pyc
> > │   │
> > │   └───management
> > │   │   __init__.py
> > │   │
> > │   └───commands
> > │   x.py
> > │   __init__.py
> >
> >
> > And this is the code of my command:
> >
> > from optparse import make_option
> > from django.core.management.base import BaseCommand, CommandError
> >
> > class Command(BaseCommand):
> > option_list = BaseCommand.option_list + (
> > make_option('--long', '-l', dest='long',
> > help='Help for the long options'),
> > )
> > help = 'Help text goes here'
> >
> > def handle(self, **options):
> >  print "This is a command"
> >
> > When I run
> >
> > python manage.py x
> >
> > I get:
> >
> > Unknown command: 'x'
> > Type 'manage.py help' for usage.
> >
> > Where should begin looking to troubleshoot this issue?
> >
> > Thanks in advance...
> >
> > Mark :)
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
>
> --
> Best regards,
> Andrey Kostakov
> Email/Gtalk: b...@dzen.ws
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Custom Commands?

2013-04-11 Thread Mark Lybrand
To answer my own question: Yes,  that works.  Follow up question: does each
app need its own set of commands?  It would seem funny to put all the
commands for a project into one of the apps.  Or is that the idea?  That
commands are meant to be app-specific?


On Thu, Apr 11, 2013 at 4:41 AM, Mark Lybrand  wrote:

> So, you have a management/commands structure in each app of your project
> and not in the main "app" (or whatever that thing is called).  Here is the
> structure of my whole project thus far (I had just shown the part that I
> thought was important).  As you can see I already had an app and the app is
> included in the INSTALLED_APPS of settings.py:
>
> │   manage.py
>
> │
> ├───mysite
> │   │   settings.py
> │   │   settings.pyc
> │   │   urls.py
> │   │   urls.pyc
> │   │   wsgi.py
> │   │   wsgi.pyc
> │   │   __init__.py
> │   │   __init__.pyc
> │   │
> │   └───management
> │   │   __init__.py
> │   │
> │   └───commands
> │   x.py
> │   __init__.py
> │
> ├───mytemplates
> │   ├───admin
> │   │   base_site.html
> │   │   index.html
> │   │
> │   └───polls
> │   detail.html
> │   index.html
> │   results.html
> │
> └───polls
> admin.py
> admin.pyc
> models.py
> models.pyc
> tests.py
> urls.py
> urls.pyc
> views.py
> views.pyc
> __init__.py
> __init__.pyc
>
>
>
> On Wed, Apr 10, 2013 at 11:54 PM, Andrey Kostakov  wrote:
>
>> For first step you need create application, "manage.py startapp myapp".
>> 'management' folder should be located in your application folder. And
>> don't forget add application in INSTALLED_APPS in your settings.py
>> (INSTALLED_APPS = ('myapp', ))
>>
>> On Thu, Apr 11, 2013 at 4:52 AM, Mark Lybrand  wrote:
>> > I am at a loss how to get custom commands working in my Django project.
>> >
>> > I am on Windows 7, running Python 2.7.3, Django 1.4.5.  When I try to
>> make
>> > my "hello world" command, I get an unknown command error.
>> >
>> > I have the following structure:
>> >
>> > │   manage.py
>> > │
>> > ├───mysite
>> > │   │   settings.py
>> > │   │   settings.pyc
>> > │   │   urls.py
>> > │   │   urls.pyc
>> > │   │   wsgi.py
>> > │   │   wsgi.pyc
>> > │   │   __init__.py
>> > │   │   __init__.pyc
>> > │   │
>> > │   └───management
>> > │   │   __init__.py
>> > │   │
>> > │   └───commands
>> > │   x.py
>> > │   __init__.py
>> >
>> >
>> > And this is the code of my command:
>> >
>> > from optparse import make_option
>> > from django.core.management.base import BaseCommand, CommandError
>> >
>> > class Command(BaseCommand):
>> > option_list = BaseCommand.option_list + (
>> > make_option('--long', '-l', dest='long',
>> > help='Help for the long options'),
>> > )
>> > help = 'Help text goes here'
>> >
>> > def handle(self, **options):
>> >  print "This is a command"
>> >
>> > When I run
>> >
>> > python manage.py x
>> >
>> > I get:
>> >
>> > Unknown command: 'x'
>> > Type 'manage.py help' for usage.
>> >
>> > Where should begin looking to troubleshoot this issue?
>> >
>> > Thanks in advance...
>> >
>> > Mark :)
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to django-users+unsubscr...@googlegroups.com.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/django-users?hl=en.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>>
>>
>>
>> --
>> Best regards,
>> Andrey Kostakov
>> Email/Gtalk: b...@dzen.ws
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
> --
> Mark :)
>



-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Custom Commands?

2013-04-11 Thread Mark Lybrand
Sorry about that, here is the tuple in question:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'polls',
)

I have the x.py command working now.  As I placed the management/commands
in the polls app as opposed the mysite "thing".   So that I am calling
things what they need to be called, the outer folder (the one that the
Django docs say I can rename) is that the project directory?  Or is the
inner directory of the same name, which I have been thinking of as a "base
app" the project directory?  The "base app" is not in the INSTALLED_APPS
tuple, but you are saying that I CAN include it there and have the
management/commands stuff in there if I think it makes organizational
sense?  Does making the "base app" an INSTALLED_APP bring with it any
security or performance issues I should be aware of?

Thanks for all the help.


On Thu, Apr 11, 2013 at 5:14 AM, Tom Evans  wrote:

> On Thu, Apr 11, 2013 at 12:41 PM, Mark Lybrand  wrote:
> > So, you have a management/commands structure in each app of your project
> and
> > not in the main "app" (or whatever that thing is called).  Here is the
> > structure of my whole project thus far (I had just shown the part that I
> > thought was important).
>
> Yes, management commands that relate to your poll objects should
> probably belong in the poll app. Management commands that use the
> functionality of two or more apps, make your own choice about where
> they live.
>
> Usually, one app may add functionality to another app - the management
> command that uses both apps should go in the former, since the latter
> may be used by itself, and in that scenario the management command
> would not make sense.
>
> > As you can see I already had an app and the app is
> > included in the INSTALLED_APPS of settings.py:
>
> Not seeing your settings.py or anything called 'app', hard to comment on!
>
> >
> > │   manage.py
> >
> > │
> > ├───mysite
> > │   │   settings.py
> > │   │   settings.pyc
> > │   │   urls.py
> > │   │   urls.pyc
> > │   │   wsgi.py
> > │   │   wsgi.pyc
> > │   │   __init__.py
> > │   │   __init__.pyc
> > │   │
> > │   └───management
> > │   │   __init__.py
> > │   │
> > │   └───commands
> > │   x.py
> > │   __init__.py
>
> Is mysite an app? In my projects, 'mysite' is the project directory.
> It holds the things that apply across the entire project, like the top
> level urls.py, settings.py and so on, doesn't provide any models and
> doesn't hook in to the admin site, so in my projects it's not an app -
> meaning it's not a package listed in INSTALLED_APPS.
>
> The only reason to have it as an app would be so that your management
> commands are discoverable. In general, my sites have a main app,
> separate from the project directory, and this is where I place my
> management commands that apply just to this project, and management
> commands that apply to all uses of an app live in that app.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Custom Commands?

2013-04-11 Thread Mark Lybrand
Thanks.  I appreciate the glimpse into how another developer organizes
their application. This will help me decide what I think might work for my
needs.


On Thu, Apr 11, 2013 at 5:44 AM, Tom Evans  wrote:

> On Thu, Apr 11, 2013 at 1:22 PM, Mark Lybrand  wrote:
> > Sorry about that, here is the tuple in question:
> >
> > INSTALLED_APPS = (
> > 'django.contrib.auth',
> > 'django.contrib.contenttypes',
> > 'django.contrib.sessions',
> > 'django.contrib.sites',
> > 'django.contrib.messages',
> > 'django.contrib.staticfiles',
> > # Uncomment the next line to enable the admin:
> > 'django.contrib.admin',
> > # Uncomment the next line to enable admin documentation:
> > # 'django.contrib.admindocs',
> > 'polls',
> > )
> >
> > I have the x.py command working now.  As I placed the
> management/commands in
> > the polls app as opposed the mysite "thing".   So that I am calling
> things
> > what they need to be called, the outer folder (the one that the Django
> docs
> > say I can rename) is that the project directory?  Or is the inner
> directory
> > of the same name, which I have been thinking of as a "base app" the
> project
> > directory?  The "base app" is not in the INSTALLED_APPS tuple, but you
> are
> > saying that I CAN include it there and have the management/commands
> stuff in
> > there if I think it makes organizational sense?  Does making the "base
> app"
> > an INSTALLED_APP bring with it any security or performance issues I
> should
> > be aware of?
> >
> > Thanks for all the help.
> >
>
> So INSTALLED_APPS is a bit of magic. It's used by various things in
> django to load resources. Eg:
>   When you run syncdb, Django installs models from app.models for each
> app in INSTALLED_APPS
>   The templating system, templates and custom template tags are
> searched for in each of the apps in INSTALLED_APPS
>   Management commands are loaded by searching
> app.management.commands. for each app in INSTALLED_APPS
>   The admin site discovers the models it knows about by loading
> app.admin from each app in INSTALLED_APPS
>
> I'm probably missing some..
>
> You can make your project directory an app if you wish. My golden rule
> is "an app is a module that provides any of models, templates,
> template tags, admin or management commands".
>
> I keep them separate to avoid confusion, so I will have a 'site' app
> that provides the homepage/similar views, site specific models,
> templates and so on, and a separate 'project' module that just
> contains the settings, the top level urlconf and DB routers.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Status of Django with Python 3.x

2013-04-11 Thread Mark Lybrand
I understand that there is only experimental support for Python 3.x in
Django 1.5.  Is there any feeling for how far out a stable version of
Django using Python 3.x might be?  I understand that any answer is likely
to be conjecture and guessing and that is okay.  I am just trying to gauge
if I am looking at a matter of months or a year or if it something that may
be 3 or 5 or more years out.

Thanks in advance.

-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Static Files on IIS install

2013-04-11 Thread Mark Lybrand
I have managed to get a Django app installed on IIS7.  It is not finding
the static files for the admin section.  Can someone give me some pointers
on the steps I need to take to get static files to work in general, as well
as specifically how to make my Django app pull the appropriate static files
from the core django package? What information do you need from me to be
able to answer this question?

Thanks in advance.

-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Static Files on IIS install

2013-04-11 Thread Mark Lybrand
I will read those links as soon as I get a chance.

As for the particulars:

Errors:

"NetworkError: 404 NOT FOUND - http://localhost:8001/static/admin/css/base.css";

"NetworkError: 404 NOT FOUND -
http://localhost:8001/static/admin/css/dashboard.css";

OS: Windows 7
Web server: IIS 7 with FastCGI
Python: 2.7.4
Django: 1.4.5


Should I post my settings.py file as well?




On Thu, Apr 11, 2013 at 10:21 PM, Mike Dewhirst wrote:

> On 12/04/2013 12:56pm, Mark Lybrand wrote:
>
>> I have managed to get a Django app installed on IIS7.  It is not finding
>> the static files for the admin section.  Can someone give me some
>> pointers on the steps I need to take to get static files to work in
>> general,
>>
>
> https://docs.djangoproject.**com/en/1.4/howto/static-files/<https://docs.djangoproject.com/en/1.4/howto/static-files/>
>
> This assumes you are using Django 1.4
>
>
>  as well as specifically how to make my Django app pull the
>
>> appropriate static files from the core django package?
>>
>
> https://docs.djangoproject.**com/en/1.4/howto/static-files/**
> #deploying-static-files-in-a-**nutshell<https://docs.djangoproject.com/en/1.4/howto/static-files/#deploying-static-files-in-a-nutshell>
>
>
> What information
>
>> do you need from me to be able to answer this question?
>>
>
> Specific error messages if something fails. Django version. Python version.
>
> If it isn't finding static files there won't necessarily be error messages
> - you will probably just see raw html. View page source to discover where
> it is looking for static files and compare what you see with STATIC_URL.
> IIS has to look in STATIC_ROOT for those.
>
> hth
>
> Mike
>
>
>> Thanks in advance.
>>
>> --
>> Mark :)
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to 
>> django-users+unsubscribe@**googlegroups.com
>> .
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at 
>> http://groups.google.com/**group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>> .
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> django-users+unsubscribe@**googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at 
> http://groups.google.com/**group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>


-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: One Way to Install Django on IIS

2013-04-12 Thread Mark Lybrand
Cool.Please provide feedback so we can make the steps better.  Already have
another friend encounter some issues trying to work our steps with his
config.  The more configs we put through the paces, the better this can be
:)
On Apr 12, 2013 4:18 PM, "Nick D"  wrote:

> Just what I'm going to need when I'm done with development.
>
> Thanks!
>
> On Friday, April 12, 2013 6:02:49 AM UTC-7, Mark Lybrand wrote:
>
>> My buddy and I were working last night on getting Django running on IIS7.
>>  We are not quite done as we are still working out issues surrounding
>> static files.  However, I thought these steps might be useful to others who
>> are struggling to get this working.
>>
>> Any thoughts or corrections welcome and appreciated:
>>
>> http://codesmartinc.com/2013/**04/12/running-django-in-**iis7iis8/<http://codesmartinc.com/2013/04/12/running-django-in-iis7iis8/>
>>
>>
>>
>> --
>> Mark :)
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: need help with csv export

2013-04-13 Thread Mark Lybrand
Have you looked at this:

http://docs.python.org/2/library/csv.html


On Fri, Apr 12, 2013 at 2:53 PM, frocco  wrote:

> Hello,
>
> I have a php export file that I need to duplicate in django.
> I am using django csv import
>
> Here is the PHP format I want.
>
> 3128559,"GOODYEAR","4024064","","","","","","","","","","","16","","","","",""
>
> Here is the django output
> 3128559,'GENERAL','15480',,,'4'
>
> I want it to look like the PHP version.
>
> Here is my brief django code:
>
> with open('D11238135.csv', 'w') as writer:
>
>line1 = '3128559'
> line2 = "'" + manufacturer + "'"
> line3 = "'" + row.sku + "'"
> line4 = ''
> line5 = ''
> line6 = ''
> line7 = ''
> line8 = ''
> line9 = ''
> line10 = ''
> line11 = ''
> line12 = ''
> line13 = ''
> line14 = "'" + str(row.stock) + "'"
> line15 = ''
> line16 = ''
> line17 = ''
> line18 = ''
>
> writer.writerow([line1, line2, line3, line4, line5, line6,
> line7, line8, line9, line10, line11,
>  line12, line13, line14, line15, line16,
> line17, line18])
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




VirtualEnv After the Fact

2013-04-13 Thread Mark Lybrand
Okay, so I started learning and messing around with Django before learning
about VirtualEnv.  What is the best thing for me to do to start using
VirtualEnv?  I assume that I must uninstall Django; is that right?  Do I
need to pretty much uninstall all the packages I have installed up to now
(so that I can start just installing within my VirtualEnvs?

BTW, I am on Windows 7 (and sometime Ubuntu 12) if either of those matter.

I apologize if this question is stupid.

-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django Package Manager and Alternate Configs

2013-04-13 Thread Mark Lybrand
Another question that comes to my mind, is there such a thing as a Django
Package manager (kind of PPM for Perl or NPM for node or ruby gems or
NuGet... well, you get the idea)?

Related: are there packages available to switch out the Django ORM (sort of
like .Net has EF or NHibernate)?  Or to switch out the templating (like
webforms vs. razor or rdoc vs haml, etc)?  Or basically, what are coming
features that folks switch out when they get past the initial "learn to
make a Django app" stage?

TIA

-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




debugging with pycharm

2013-04-21 Thread Mark Lybrand
I can't get PyCharm to break at breakpoints when debugging a django app.
what is the magic incantation i neec to invoke to make this happen
regardless of where i am in code (views, urls, models, templates, etc)

-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: debugging with pycharm

2013-04-22 Thread Mark Lybrand
It would appear that this was broken in 2.7.1.  When I upgraded to 2.7.2
my breakpoints once again work as expected.



On Mon, Apr 22, 2013 at 10:58 AM, Nikolas Stevenson-Molnar <
nik.mol...@consbio.org> wrote:

>  I assume you're running it in the debugger? Make sure you regular server
> isn't still running. Also, make sure your break point is on a line a line
> which does something (e.g., *not* on a class/function definition, empty
> line, etc.)
>
> _Nik
>
>
> On 4/21/2013 10:14 PM, Mark Lybrand wrote:
>
> I can't get PyCharm to break at breakpoints when debugging a django app.
> what is the magic incantation i neec to invoke to make this happen
> regardless of where i am in code (views, urls, models, templates, etc)
>
> --
> Mark :)
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: debugging with pycharm

2013-04-23 Thread Mark Lybrand
I hope not :(  I will check template debugging tomorrow.  I have already
started looking at WingIDE as an alternative, but would much prefer to
stick with PyCharm, since I am familiar with other JetBrain products.


On Mon, Apr 22, 2013 at 9:49 PM, Ezequiel  wrote:

> On Monday, April 22, 2013 3:03:11 PM UTC-3, Mark Lybrand wrote:
>
>>
>> It would appear that this was broken in 2.7.1.  When I upgraded to 2.7.2
>> my breakpoints once again work as expected.
>>
>
> I think in 2.7.1 the BP did not work if you set them after running server,
> on 2.7.2 is fixed. But in 2.7.2 I've lost the debug on templates, Do you
> also happened to you?
>
> ---
> Ezequiel
> http://flickrock.com/mikelpierre
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mark :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: question about django tutorial

2013-04-30 Thread Mark Lybrand
Try:

python manage.py syncdb

If you have set up the rest of your project with the admin stuff, then this
should create the tables for you.

Then run

python manage.py runserver again.

Mark :)


On Tue, Apr 30, 2013 at 1:45 PM, Christopher Spears
wrote:

> Hi!
>
> I am a Django newbie, so please bear with me.  I am working on part 2 of
> the Django tutorial.
>
> I started my server with the following:
>
> python manage.py runserver
>
>
> Then I logged into my admin site.
>
> Earlier in the tutorial, I had created a model called Polls.  I selected
> Polls from the Site administration menu and then selected the 'What's up?'
> version of Polls to change.  However, when I clicked on the 'Save and
> Continue Editing' Button, I got this traceback:
>
> Environment:
>
>
> Request Method: POST
> Request URL: http://127.0.0.1:8000/admin/polls/poll/1/
>
> Django Version: 1.5.1
> Python Version: 2.7.4
> Installed Applications:
> ('django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'django.contrib.admin',
>  'polls')
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
>
>
> Traceback:
> File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   115. response = callback(request,
> *callback_args, **callback_kwargs)
> File "C:\Python27\lib\site-packages\django\contrib\admin\options.py" in
> wrapper
>   372. return self.admin_site.admin_view(view)(*args,
> **kwargs)
> File "C:\Python27\lib\site-packages\django\utils\decorators.py" in
> _wrapped_view
>   91. response = view_func(request, *args, **kwargs)
> File "C:\Python27\lib\site-packages\django\views\decorators\cache.py" in
> _wrapped_view_func
>   89. response = view_func(request, *args, **kwargs)
> File "C:\Python27\lib\site-packages\django\contrib\admin\sites.py" in inner
>   202. return view(request, *args, **kwargs)
> File "C:\Python27\lib\site-packages\django\utils\decorators.py" in _wrapper
>   25. return bound_func(*args, **kwargs)
> File "C:\Python27\lib\site-packages\django\utils\decorators.py" in
> _wrapped_view
>   91. response = view_func(request, *args, **kwargs)
> File "C:\Python27\lib\site-packages\django\utils\decorators.py" in
> bound_func
>   21. return func(self, *args2, **kwargs2)
> File "C:\Python27\lib\site-packages\django\db\transaction.py" in inner
>   223. return func(*args, **kwargs)
> File "C:\Python27\lib\site-packages\django\contrib\admin\options.py" in
> change_view
>   1108. self.log_change(request, new_object,
> change_message)
> File "C:\Python27\lib\site-packages\django\contrib\admin\options.py" in
> log_change
>   546. change_message  = message
> File "C:\Python27\lib\site-packages\django\contrib\admin\models.py" in
> log_action
>   19. e.save()
> File "C:\Python27\lib\site-packages\django\db\models\base.py" in save
>   546.force_update=force_update,
> update_fields=update_fields)
> File "C:\Python27\lib\site-packages\django\db\models\base.py" in save_base
>   650. result = manager._insert([self], fields=fields,
> return_id=update_pk, using=using, raw=raw)
> File "C:\Python27\lib\site-packages\django\db\models\manager.py" in _insert
>   215. return insert_query(self.model, objs, fields, **kwargs)
> File "C:\Python27\lib\site-packages\django\db\models\query.py" in
> insert_query
>   1661. return query.get_compiler(using=using).execute_sql(return_id)
> File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py" in
> execute_sql
>   937. cursor.execute(sql, params)
> File "C:\Python27\lib\site-packages\django\db\backends\util.py" in execute
>   41. return self.cursor.execute(sql, params)
> File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py" in
> execute
>   366. six.reraise(utils.DatabaseError,
> utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
> File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py" in
> execute
>   362. return Database.Cursor.execute(self, query, params)
>
> Exception Type: DatabaseError at /admin/polls/poll/1/
> Exception Value: no such table: django_admin_log
>
> Was I supposed to set up this table earlier in the tutorial?  When I went
> back in the tutorial, I didn't see any mention of it.  I am working on a
> Windows laptop.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails