Django and pydoc - ImproperlyConfigured

2015-02-24 Thread Gergely Polonkai
Hello,

I'm trying to document my own webpage's code so I will remember each piece
if I have to touch it later. I added docstrings to several functions
already, and while this is generally enough, I couldn't help but tried
pydoc blog.models.Post

What I got instead of the craved documents was an ImuroperlyConfigured
exception. I found some clues that defining a settings module via the
DJANGO_SETTINGS_MODULE  environment variable would help (and it does), but
it just doesn't sound right to me. Isn't there an easier solution? (Note
that I don't count putting this env variable to the virtualenv's activate
scripts as an easier method :)

Best,
Gergely

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJiQG6O1OOWGs26nMYXjexH_H8QjbdpuapnTEHkTmN%2B6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django-users@googlegroups.com

2015-02-24 Thread Hossein Rashnoo


I use below code to authenticate in SharePoint in my view:

import sudsimport logging

logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
from suds.client import Client

url = 'http://portal:8080/rashno/_vti_bin/lists.asmx?WSDL'
from suds.transport.https import WindowsHttpAuthenticated

ntlm = WindowsHttpAuthenticated(username='***', password='***')
client = Client(url, transport=ntlm)

But i got this error:



but when do this with python shell , it authenticate me in sharepoint and 
after that i can use other sharepoint service with view or shell. can any 
one tell me whats the problem?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4425ae16-2624-40ae-aac3-bf687b0f0d1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Gunicorn sock file is missing?

2015-02-24 Thread Kaloian


I have an ansible provisioned VM based on this one 
https://github.com/jcalazan/ansible-django-stack but for some reason trying 
to start Gunicorn gives the following error:

*Can't connect to /path/to/my/gunicorn.sock *

and in nginx log file:

*connect() to unix:/path/to/my/gunicorn.sock failed (2: No such file or 
directory) while connecting to upstream*

And the socket file is really missing in the specified directory. I have 
checked the permissions of the directory and they are fine.

Here is my gunicorn_start script:


NAME="{{ application_name }}" 
DJANGODIR={{ application_path }} 
SOCKFILE={{ virtualenv_path }}/run/gunicorn.sock 
USER={{ gunicorn_user }} GROUP={{ gunicorn_group }} 
NUM_WORKERS={{ gunicorn_num_workers }} 

# Set this to 0 for unlimited requests. During development, you might want to # 
set this to 1 to automatically restart the process on each request (i.e. your # 
code will be reloaded on every request). 
MAX_REQUESTS={{ gunicorn_max_requests }} 
echo "Starting $NAME as `whoami`" 
# Activate the virtual environment. 
cd $DJANGODIR 
. ../../bin/activate 
# Set additional environment variables. 
. ../../bin/postactivate 
# Create the run directory if it doesn't exist. 
RUNDIR=$(dirname $SOCKFILE) test -d $RUNDIR || mkdir -p $RUNDIR 
# Programs meant to be run under supervisor should not daemonize themselves # 
(do not use --daemon). 
exec gunicorn \ --name $NAME \ 
--workers $NUM_WORKERS \ 
--max-requests $MAX_REQUESTS \ 
--user $USER --group $GROUP \ 
--log-level debug \ 
--bind unix:$SOCKFILE \ 
{{ application_name }}.wsgi


Can anyone point me to any direction what could be causing the missing 
gunicorn.sock file ?

Thanks

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f4fa6c59-9b9c-4433-831d-0f563b5dd763%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


TypeError: __str__ returned non-string (type bytes)

2015-02-24 Thread Mike Dewhirst

This is driving me insane so any hints will be greatly appreciated ...

Thanks

Mike

Here is the entire unedited test sequence plus failing code ...

Python:   3.4
Django:   1.6.9
SQLite3:  memory

Creating test database for alias 'default'...
.E.E...
==
ERROR: test_checkreference_exp 
(substance.tests.test_substance.TestSubstance)

--
Traceback (most recent call last):
  File 
"C:\Users\mike\env\xxdx3\ssds\substance\tests\test_substance.py", line 
57, in test_checkreference_exp

self.assertEqual(subst.checkreference('1'), True)
  File "C:\Users\mike\env\xxdx3\ssds\substance\models\substance.py", 
line 449, in checkreference

if checkit(self, ref):
  File "C:\Users\mike\env\xxdx3\ssds\substance\models\substance.py", 
line 441, in checkit

val = u"{0}".format(obj.__dict__[field])
TypeError: __str__ returned non-string (type bytes)

==
ERROR: testcheckreference_gas (substance.tests.test_substance.TestSubstance)
--
Traceback (most recent call last):
  File 
"C:\Users\mike\env\xxdx3\ssds\substance\tests\test_substance.py", line 
75, in test_checkreference_gas

self.assertEqual(subst.checkreference('1'.encode('utf-8')), True)
  File "C:\Users\mike\env\xxdx3\ssds\substance\models\substance.py", 
line 449, in checkreference

if checkit(self, ref):
  File "C:\Users\mike\env\xxdx3\ssds\substance\models\substance.py", 
line 441, in checkit

val = u"{0}".format(obj.__dict__[field])
TypeError: __str__ returned non-string (type bytes)

--
Ran 7 tests in 1.281s

FAILED (errors=2)
Destroying test database for alias 'default'...

So here is the method in the substance model. The idea is that we check 
to see if the user included a bracketed reference in any field of 
substance or any field of a related object. I'll chop out the middle of 
the method to save space.


def checkreference(self, ref):
"""Check all potential char fields for ref in square brackets 
eg [1]


Give up as soon as it is found. Otherwise raise validation error.
"""
def checkit(obj, ref):
"""Return True immediately but don't return False unless all
fields have been checked."""
for field in obj.__dict__:
val = u"{0}".format(obj.__dict__[field])
if ref in val:
return True

assert(ref)
ref = "[{0}]".format(ref)
# first check self - the substance itself
if checkit(self, ref):
return True
# now each of the 1:1 and 1:n objects
try:
obj = Solid.objects.get(substance=self)
if checkit(obj, ref):
return True
except Solid.DoesNotExist:
pass

raise ValidationError("Reference {0} does not appear in any "
"field".format(ref))

... and here is one of the tests (line 57 in the traceback) in error ...

def test_checkreference_exp(self):
subst = Substance.objects.get(name="Hazsub")
exp, c = Explosive.objects.get_or_create(substance=subst)
exp.compatibility = '[1]'
exp.save()
self.assertEqual(subst.checkreference('1'), True)



--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54ED50A5.3030909%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Read a csv file and save data in postgresql

2015-02-24 Thread carlos
or maybe used this app, in the admin

https://github.com/bmihelac/django-import-export

Cheers

On Tue, Feb 24, 2015 at 7:57 PM, Kelvin Wong  wrote:

> Looking at your code, maybe this one is better
>
> https://pypi.python.org/pypi/unicodecsv/0.9.4
>
> This thing will make a dict, which you can make into a object by feeding
> it to a modelform.
>
> K
>
>
> On Tuesday, February 24, 2015 at 3:53:19 PM UTC-8, elcaiaimar wrote:
>>
>> Hello,
>>
>> I have a website and I need that users can introduce a csv file and save
>> their data in a postgresql database. I can introduce a file and save it in
>> media_dir and in the database (only the url). But what I want is save each
>> row as a register in a table. I've searched some examples but I haven't
>> found exactly this.
>>
>> Is it possible to do? Has anyone done this before? I put my code to save
>> the file in a database and in media below:
>>
>> *views*
>> if 'formularioarchivo' in request.POST:
>> formularioarchivo = UploadForm(request.POST, request.FILES)
>> if formularioarchivo.is_valid():
>>   newdoc = Archivo(docfile = request.FILES['docfile'])
>>   newdoc.save(formularioarchivo)
>>   return HttpResponseRedirect('/edicioncuenca/')
>>
>> else:
>> formularioarchivo = UploadForm()
>>
>> *models*
>> class Archivo(models.Model):
>> # gid_archivo = models.IntegerField(primary_key=True)
>> docfile = models.FileField(upload_to='%Y/%m/%d')
>>
>> *forms*
>> class UploadForm(forms.Form):
>> docfile = forms.FileField(
>> label='Selecciona un archivo'
>> )
>>
>> *template*
>> > enctype="multipart/form-data">
>>   {% csrf_token %}
>>   {{ formularioarchivo.as_p }}
>>   
>> 
>>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/73c23c31-f3b3-4064-bee5-45bad3e508cf%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM-7rO0hBEAq9qhjqJtwfVCxuihHbwUdn%2B0jw7QRrUDSASd58A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python / Django slow ? Deciding my next technological stack

2015-02-24 Thread Russell Keith-Magee
On Wed, Feb 25, 2015 at 7:30 AM, Benj  wrote:

> Hi,
> i'm going to invest lots of time and energy in various web projects
> (mostly community web sites), and want to pick up a language / framework
> and invest heavily on it.
> I've spent a lot of time evaluating the various options, and narrowed my
> choice to 2 stacks: C sharp asp.net  MVC or Python / Django.
>
> I'm more attracted to Python / Django combo, because of the Python
> language, and high level framework Django. I really want to use these.
> My only concern is speed. I read that Python can't run concurrent tasks,
> is this true ? So a multi-processor with hyperthreads won't benefit the
> stack and even slow it down ?
> I have no clue how this translates in reality, but should I expect
> noticable performance difference on a same server, shall I use Python /
> Django than if I had C Sharp Asp.net ?
> I don't want to invest lots of time and efforts only to discover in the
> end that the site is slow.
> You that have real world experiences with running sites, what are your
> conclusions ?
>

Instagram is a Django site. Disqus is a Django site. Many of the Mozilla
properties are Django sites. I guarantee that these sites serve more
traffic than your site will *ever* serve.

Don't get me wrong - these sites have all had to pay careful attention to
the design of their systems, and in many cases have made extensive
modifications to "stock" Django to support high performance. However -
again - they also serve *much* more traffic than your site will *ever*
serve.

C#/ASP.net isn't magical performance sauce. Django and/or the Python GIL
isn't a magical performance drain. The choices you make in database schema
design, caching strategies, query profiling and algorithm choices will
affect your site performance *long* before the limitations of Python or
Django start to become the limiting factor.

My advice to you - as long as your candidate frameworks meet basic
performance requirements, and there's evidence that they can scale to
larger sites (ASP.net, Django, and Ruby on Rails all easily meet these
criteria), don't worry about performance. Worry about the language you like
to use, the speed of development, the community that exists around the
tools, and so on.

Yours,
Russ Magee %-)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq84_tcPG7V1%3DM9UU-vSATnXFbekuzDcr8xm5UoTY8sUk-Zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django GUI Frameworks?

2015-02-24 Thread Vijay Khemlani
Old platforms such as ASP.NET "Classic" (not MVC) have some sort of widgets
(Web Forms in the case of of ASP) that rendered very customized (and very
ugly) HTML that "worked" with their backend.

The trend nowadays is to separate the backend and frontend as much as
posible, allowing any frontend framework (Angular, JQuery UI, whatever) to
play nicely with any reasonable backend (Django, RoR, etc) using common
techniques.

On Tue, Feb 24, 2015 at 10:42 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> Hi Thomas,
>
> On Wed, Feb 25, 2015 at 4:29 AM, ThomasTheDjangoFan <
> stefan.eichholz.ber...@googlemail.com> wrote:
>
>> Hi ya,
>>
>> I wonder if Django has any gui-frameworks which give common solutions for
>> handling frontend data, p.e. in combination with Twitter Bootstrap?
>> Some time ago I had a look at the YII PHP Framework and they have a great
>> solution called Yiibooster (check it out at
>> http://yiibooster.clevertech.biz/jsonGridView).
>>
>> Yiibooster offers a lot of widgets - all in one framework.
>> Is there anything like this for django?
>>
>
> Your question highlights that you've missed an important point.
>
> Django is fundamentally a server-side framework. That means it mostly
> handles database requests, HTTP requests, cookies, and so on. At the end of
> the day, it's a big function for turning  "http://example.com/mypage";
> into "...".
>
> What you put *inside* the  is entirely up to you. You want to use
> bootstrap? Use bootstrap. You want to use Zurb Foundation? Use Zurb
> Foundation. You want to use JQueryUI? Use JQueryUI? Want to use all three?
> Use all three.
>
> Django doesn't care *what* you render to the client - it provides a
> template language to make it easy to render whatever you want.
>
> So - at it's core, your question doesn't make sense. No, Django doesn't
> provide support for handling frontend data - because you can use whatever
> frontend solution you want.
>
> That said, there are some ways that third party developers have been able
> to make it *easier* to use frontend tools with Django, by doing things like
> providing template tags to render frontend widgets, and providing Django
> REST framework configurations to support specific AJAX callback formats.
> These usually come in the form of third party libraries, which you can
> generally find by Googling for "Django ". I
> don't have any specific recommendations for good ones, but Django Packages
> [1] might give you some guidance.
>
> [1] https://www.djangopackages.com
>
> Yours
> Russ Magee %-)
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJxq849-vGAUW4Bgbx3ONLSLJnFs19fqOnUXa%3DrzAAHgkrmHyg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1GaSLg%3DvQrHyqxvF6HKoVNKfT9Ujfps8NxzpfjFBaAuQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Read a csv file and save data in postgresql

2015-02-24 Thread Kelvin Wong
Looking at your code, maybe this one is better

https://pypi.python.org/pypi/unicodecsv/0.9.4

This thing will make a dict, which you can make into a object by feeding it 
to a modelform.

K


On Tuesday, February 24, 2015 at 3:53:19 PM UTC-8, elcaiaimar wrote:
>
> Hello,
>
> I have a website and I need that users can introduce a csv file and save 
> their data in a postgresql database. I can introduce a file and save it in 
> media_dir and in the database (only the url). But what I want is save each 
> row as a register in a table. I've searched some examples but I haven't 
> found exactly this.
>
> Is it possible to do? Has anyone done this before? I put my code to save 
> the file in a database and in media below:
>
> *views*
> if 'formularioarchivo' in request.POST:
> formularioarchivo = UploadForm(request.POST, request.FILES)
> if formularioarchivo.is_valid():
>   newdoc = Archivo(docfile = request.FILES['docfile'])
>   newdoc.save(formularioarchivo)
>   return HttpResponseRedirect('/edicioncuenca/')
>
> else:
> formularioarchivo = UploadForm()
>
> *models*
> class Archivo(models.Model):
> # gid_archivo = models.IntegerField(primary_key=True)
> docfile = models.FileField(upload_to='%Y/%m/%d')
>
> *forms*
> class UploadForm(forms.Form):
> docfile = forms.FileField(
> label='Selecciona un archivo'
> )
>
> *template*
>  enctype="multipart/form-data">
>   {% csrf_token %}
>   {{ formularioarchivo.as_p }}
>   
> 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/73c23c31-f3b3-4064-bee5-45bad3e508cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django GUI Frameworks?

2015-02-24 Thread Russell Keith-Magee
Hi Thomas,

On Wed, Feb 25, 2015 at 4:29 AM, ThomasTheDjangoFan <
stefan.eichholz.ber...@googlemail.com> wrote:

> Hi ya,
>
> I wonder if Django has any gui-frameworks which give common solutions for
> handling frontend data, p.e. in combination with Twitter Bootstrap?
> Some time ago I had a look at the YII PHP Framework and they have a great
> solution called Yiibooster (check it out at
> http://yiibooster.clevertech.biz/jsonGridView).
>
> Yiibooster offers a lot of widgets - all in one framework.
> Is there anything like this for django?
>

Your question highlights that you've missed an important point.

Django is fundamentally a server-side framework. That means it mostly
handles database requests, HTTP requests, cookies, and so on. At the end of
the day, it's a big function for turning  "http://example.com/mypage"; into
"...".

What you put *inside* the  is entirely up to you. You want to use
bootstrap? Use bootstrap. You want to use Zurb Foundation? Use Zurb
Foundation. You want to use JQueryUI? Use JQueryUI? Want to use all three?
Use all three.

Django doesn't care *what* you render to the client - it provides a
template language to make it easy to render whatever you want.

So - at it's core, your question doesn't make sense. No, Django doesn't
provide support for handling frontend data - because you can use whatever
frontend solution you want.

That said, there are some ways that third party developers have been able
to make it *easier* to use frontend tools with Django, by doing things like
providing template tags to render frontend widgets, and providing Django
REST framework configurations to support specific AJAX callback formats.
These usually come in the form of third party libraries, which you can
generally find by Googling for "Django ". I
don't have any specific recommendations for good ones, but Django Packages
[1] might give you some guidance.

[1] https://www.djangopackages.com

Yours
Russ Magee %-)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq849-vGAUW4Bgbx3ONLSLJnFs19fqOnUXa%3DrzAAHgkrmHyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Delete the file related on the FileField

2015-02-24 Thread Karim
I'm using a form that get an image and store it in the database. Doing my
(manual) tests I discover that the deleting the FileField doesn't remove
the associated file on the hard disk. Is there a design pattern to handle
the remaining file?

Thank you.

-- 
Karim N. Gorjux

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACeuRGWhTivr%2Bk8au0KpFCoCmL619-9kOAeJkCmvSkrXjALNPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form Wizard: how to send instance_dict based on the request

2015-02-24 Thread Karim
On Fri, Feb 20, 2015 at 5:49 AM, Collin Anderson 
wrote:

> You could instead just override get_form_instance(step). That way you'll
> have access to self.request.
>

​Thank you!​



-- 
Karim N. Gorjux

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACeuRGXmP0yHA4TmXGTpywCkY3%2B86gNnx8Y85%2Bz44BePfs3TyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Form Wizard: store the session values

2015-02-24 Thread Karim
When I click on the link for my form, I would like to restore the session
values if the user accidentally left the wizard or other cases happened.

How I can restore the session and initialize the FormWizard with the
session values? Everytime I click on the link to render the view I got an
empty form.

Thank you.

-- 
Karim N. Gorjux

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACeuRGWCYjFh4D16cOZLgb-EL%2BQnZT859frm%2ByetBxbQw-csYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Form wizard: how I can jump on a specific step?

2015-02-24 Thread Karim
Hi all! I'm moving a really long form on a FormWizard[1] using the class "
SessionWizardView
​" everything is fine. All works in adding and editing of the model I'm
using on the modelset.

Now I have some questions to improve the "quality" of the wizard.

I added a navbar with the active class for the current step. I wold like to
make the navbar clickable and let the user jump to a specific step. Because
I'm using the wizard in adding end in editing and the validation is form by
form (step by step), how I can make the navbar clickable?

1) In adding I can click on the previous forms
2) In editing I can click on every step

In the django doc the previous button is creating with this code:


Previous


Is possible to create a link for a specific step?​
​What about the check if the step was visited and validated?

Thank you​

​

​[1]
https://docs.djangoproject.com/en/1.7/ref/contrib/formtools/form-wizard/​

-- 
Karim N. Gorjux

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACeuRGXKhdZXHuxWbp8UfRiVVQcUuSOLa8nHV3s3qQTXW0n%2BnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python / Django slow ? Deciding my next technological stack

2015-02-24 Thread Andrew Farrell
As Vijay said, most of the performance of a web app (in any framework) is
database access. With django, you can use the Django Debug Toolbar

or
the db.connection.queries

object to find out where those queries are being made and then use the
select-related

and
prefetch-related

features
of the ORM to reduce them to a minimum.

It is also worth noting that for many applications, the speed at which a
programmer is able to work effectively matters more for the success of the
project than the speed of the language. Of course, the two aren't
completely unrelated; If your unit test suite runs slowly, that will slow
down your development workflow.

If you have a need to do high-performance analysis of really large scale
data sets, python has a variety of tools like blaze
, pandas
, and numba  and is
pretty widely used in scientific computing for this reason.

On Tue, Feb 24, 2015 at 5:59 PM, Vijay Khemlani  wrote:

> It's true that the Global Interpreter Lock will prevent threads from a
> single process from running concurrently, but your server (uWSGI, gunicorn,
> etc) will spawn multiple process that don't conflict with the GIL.
>
> Also, if you need some form of multiprocessing celery is a good choice,
> and one that also doesn't collide with the GIL as it is a different process.
>
> Finally, web apps are mostly limited by I/O (database access), so the
> actual stack used usually is not that important unless you are scaling a
> lot (StackOverflow-level "a lot").
>
> I've worked with both Django and ASP.NET MVC (although an older version)
> and even though ASP.NET MVC is amazing in the level of the IDE
> (VisualStudio) and query language (Entity Framework / LINQ) it's still a
> little cumbersome for my taste (and I also prefer Linux enviroments...)
>
> On Tue, Feb 24, 2015 at 8:52 PM, Alex Mandel 
> wrote:
>
>> On 02/24/2015 03:30 PM, Benj wrote:
>> > Hi,
>> > i'm going to invest lots of time and energy in various web projects
>> (mostly
>> > community web sites), and want to pick up a language / framework and
>> invest
>> > heavily on it.
>> > I've spent a lot of time evaluating the various options, and narrowed my
>> > choice to 2 stacks: C sharp asp.net  MVC or Python / Django.
>> >
>> > I'm more attracted to Python / Django combo, because of the Python
>> > language, and high level framework Django. I really want to use these.
>> > My only concern is speed. I read that Python can't run concurrent
>> tasks, is
>> > this true ? So a multi-processor with hyperthreads won't benefit the
>> stack
>> > and even slow it down ?
>> > I have no clue how this translates in reality, but should I expect
>> > noticable performance difference on a same server, shall I use Python /
>> > Django than if I had C Sharp Asp.net ?
>> > I don't want to invest lots of time and efforts only to discover in the
>> end
>> > that the site is slow.
>> > You that have real world experiences with running sites, what are your
>> > conclusions ?
>> >
>> >
>> > I expect sites to be medium traffic: could be handled by a good
>> dedicated
>> > server or average cloud ressources.
>> >
>> > Benj
>> >
>>
>> Use a good WSGI like uwsgi or gunicorn and don't use sqlite as your db.
>> Those WSGI containers are threaded. Don't confuse running python
>> directly which is different (and there are ways to use multicores even
>> then).
>>
>> Plenty of examples of big websites running django out there.
>>
>> http://blog.disqus.com/post/62187806135/scaling-django-to-8-billion-page-views
>>
>> Enjoy,
>> Alex
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/54ED0EB9.2020505%40wildintellect.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/djang

Re: Read a csv file and save data in postgresql

2015-02-24 Thread Vijay Khemlani
Parsing a CSV file is not a particularly hard thing to do

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

You can change the example to read from the file in your model an instead
of printing to the console, to store it in the database.

On Tue, Feb 24, 2015 at 8:53 PM, elcaiaimar  wrote:

> Hello,
>
> I have a website and I need that users can introduce a csv file and save
> their data in a postgresql database. I can introduce a file and save it in
> media_dir and in the database (only the url). But what I want is save each
> row as a register in a table. I've searched some examples but I haven't
> found exactly this.
>
> Is it possible to do? Has anyone done this before? I put my code to save
> the file in a database and in media below:
>
> *views*
> if 'formularioarchivo' in request.POST:
> formularioarchivo = UploadForm(request.POST, request.FILES)
> if formularioarchivo.is_valid():
>   newdoc = Archivo(docfile = request.FILES['docfile'])
>   newdoc.save(formularioarchivo)
>   return HttpResponseRedirect('/edicioncuenca/')
>
> else:
> formularioarchivo = UploadForm()
>
> *models*
> class Archivo(models.Model):
> # gid_archivo = models.IntegerField(primary_key=True)
> docfile = models.FileField(upload_to='%Y/%m/%d')
>
> *forms*
> class UploadForm(forms.Form):
> docfile = forms.FileField(
> label='Selecciona un archivo'
> )
>
> *template*
>  enctype="multipart/form-data">
>   {% csrf_token %}
>   {{ formularioarchivo.as_p }}
>   
> 
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3b4bb9f0-2539-4486-b47a-c782ff350e99%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei3h%2BTKM8viUsXYfOjOFVJShcGmyWm-33%2BQBm3W%2B4Ve_XQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python / Django slow ? Deciding my next technological stack

2015-02-24 Thread Vijay Khemlani
It's true that the Global Interpreter Lock will prevent threads from a
single process from running concurrently, but your server (uWSGI, gunicorn,
etc) will spawn multiple process that don't conflict with the GIL.

Also, if you need some form of multiprocessing celery is a good choice, and
one that also doesn't collide with the GIL as it is a different process.

Finally, web apps are mostly limited by I/O (database access), so the
actual stack used usually is not that important unless you are scaling a
lot (StackOverflow-level "a lot").

I've worked with both Django and ASP.NET MVC (although an older version)
and even though ASP.NET MVC is amazing in the level of the IDE
(VisualStudio) and query language (Entity Framework / LINQ) it's still a
little cumbersome for my taste (and I also prefer Linux enviroments...)

On Tue, Feb 24, 2015 at 8:52 PM, Alex Mandel 
wrote:

> On 02/24/2015 03:30 PM, Benj wrote:
> > Hi,
> > i'm going to invest lots of time and energy in various web projects
> (mostly
> > community web sites), and want to pick up a language / framework and
> invest
> > heavily on it.
> > I've spent a lot of time evaluating the various options, and narrowed my
> > choice to 2 stacks: C sharp asp.net  MVC or Python / Django.
> >
> > I'm more attracted to Python / Django combo, because of the Python
> > language, and high level framework Django. I really want to use these.
> > My only concern is speed. I read that Python can't run concurrent tasks,
> is
> > this true ? So a multi-processor with hyperthreads won't benefit the
> stack
> > and even slow it down ?
> > I have no clue how this translates in reality, but should I expect
> > noticable performance difference on a same server, shall I use Python /
> > Django than if I had C Sharp Asp.net ?
> > I don't want to invest lots of time and efforts only to discover in the
> end
> > that the site is slow.
> > You that have real world experiences with running sites, what are your
> > conclusions ?
> >
> >
> > I expect sites to be medium traffic: could be handled by a good dedicated
> > server or average cloud ressources.
> >
> > Benj
> >
>
> Use a good WSGI like uwsgi or gunicorn and don't use sqlite as your db.
> Those WSGI containers are threaded. Don't confuse running python
> directly which is different (and there are ways to use multicores even
> then).
>
> Plenty of examples of big websites running django out there.
>
> http://blog.disqus.com/post/62187806135/scaling-django-to-8-billion-page-views
>
> Enjoy,
> Alex
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/54ED0EB9.2020505%40wildintellect.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei0T%2B7HokGppre4z7JhPc6P1%3DkLW%2BJ2o1vAtG0v5DD8MtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Read a csv file and save data in postgresql

2015-02-24 Thread elcaiaimar
Hello,

I have a website and I need that users can introduce a csv file and save 
their data in a postgresql database. I can introduce a file and save it in 
media_dir and in the database (only the url). But what I want is save each 
row as a register in a table. I've searched some examples but I haven't 
found exactly this.

Is it possible to do? Has anyone done this before? I put my code to save 
the file in a database and in media below:

*views*
if 'formularioarchivo' in request.POST:
formularioarchivo = UploadForm(request.POST, request.FILES)
if formularioarchivo.is_valid():
  newdoc = Archivo(docfile = request.FILES['docfile'])
  newdoc.save(formularioarchivo)
  return HttpResponseRedirect('/edicioncuenca/')

else:
formularioarchivo = UploadForm()

*models*
class Archivo(models.Model):
# gid_archivo = models.IntegerField(primary_key=True)
docfile = models.FileField(upload_to='%Y/%m/%d')

*forms*
class UploadForm(forms.Form):
docfile = forms.FileField(
label='Selecciona un archivo'
)

*template*

  {% csrf_token %}
  {{ formularioarchivo.as_p }}
  


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b4bb9f0-2539-4486-b47a-c782ff350e99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python / Django slow ? Deciding my next technological stack

2015-02-24 Thread Alex Mandel
On 02/24/2015 03:30 PM, Benj wrote:
> Hi,
> i'm going to invest lots of time and energy in various web projects (mostly 
> community web sites), and want to pick up a language / framework and invest 
> heavily on it.
> I've spent a lot of time evaluating the various options, and narrowed my 
> choice to 2 stacks: C sharp asp.net  MVC or Python / Django.
> 
> I'm more attracted to Python / Django combo, because of the Python 
> language, and high level framework Django. I really want to use these.
> My only concern is speed. I read that Python can't run concurrent tasks, is 
> this true ? So a multi-processor with hyperthreads won't benefit the stack 
> and even slow it down ?
> I have no clue how this translates in reality, but should I expect 
> noticable performance difference on a same server, shall I use Python / 
> Django than if I had C Sharp Asp.net ?
> I don't want to invest lots of time and efforts only to discover in the end 
> that the site is slow. 
> You that have real world experiences with running sites, what are your 
> conclusions ?
> 
> 
> I expect sites to be medium traffic: could be handled by a good dedicated 
> server or average cloud ressources.
> 
> Benj
> 

Use a good WSGI like uwsgi or gunicorn and don't use sqlite as your db.
Those WSGI containers are threaded. Don't confuse running python
directly which is different (and there are ways to use multicores even
then).

Plenty of examples of big websites running django out there.
http://blog.disqus.com/post/62187806135/scaling-django-to-8-billion-page-views

Enjoy,
Alex

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54ED0EB9.2020505%40wildintellect.com.
For more options, visit https://groups.google.com/d/optout.


Python / Django slow ? Deciding my next technological stack

2015-02-24 Thread Benj
Hi,
i'm going to invest lots of time and energy in various web projects (mostly 
community web sites), and want to pick up a language / framework and invest 
heavily on it.
I've spent a lot of time evaluating the various options, and narrowed my 
choice to 2 stacks: C sharp asp.net  MVC or Python / Django.

I'm more attracted to Python / Django combo, because of the Python 
language, and high level framework Django. I really want to use these.
My only concern is speed. I read that Python can't run concurrent tasks, is 
this true ? So a multi-processor with hyperthreads won't benefit the stack 
and even slow it down ?
I have no clue how this translates in reality, but should I expect 
noticable performance difference on a same server, shall I use Python / 
Django than if I had C Sharp Asp.net ?
I don't want to invest lots of time and efforts only to discover in the end 
that the site is slow. 
You that have real world experiences with running sites, what are your 
conclusions ?


I expect sites to be medium traffic: could be handled by a good dedicated 
server or average cloud ressources.

Benj

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4b92f220-55a1-4cb5-9da2-6d659bb17c14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.6 vs Django 1.4, creation of child instance immediately referenced by parent?

2015-02-24 Thread Pongetti
Hello all,

I started a project way back in the days of Django 1.4.  I am trying to 
upgrade to version 1.6 to make use of some new features.

Anyway, I am coming across this curious change.  Its probably meant to be a 
fix rather than a bug, but its causing huge issues with my code and I did 
not find anything that I thought dealt with it in the release notes, nor 
anybody else mentioning it in my Googles.

Take a very simple Parent->Child relationship:
class TestModel(models.Model):
pass
 
class TestModelChild(models.Model):
parent = models.OneToOneField(TestModel)

Now run this simple code
parent = TestModel()
child = TestModelChild(parent=parent)

print parent.testmodelchild

In Django 1.4, the final line would raise an exception as the parent model 
does not have any reference to the child at this point
In Django 1.6, the parent can immediately see the "child" instance.  Its 
already there

Seems logical, and I'm guessing necessary for the new transaction model, 
but as I said, causing huge problems and I can't find anything to warn me 
of it.  Wasn't sure whether to ask how to fix it, report it as a bug or 
ignore it.  Thought I'd post here, maybe someone has a suggestion?

BTW, the reason its causing me issues specifically?
I have one view with a two ModelForms, one for the parent, one for the 
child, and I initialize them like so:

form_parent = TestModelForm(request.POST, instance=parent)
form_child = TestModelForm(request.POST, instance=child)
form_parent.save()
form_child.save()

form_parent.save() causes an exception as its save function is overridden 
and does some work on the child if it exists.  In 1.4 it didn't exist yet 
on first save of the parent.  In 1.6 the child exists even though it really 
shouldn't yet.  There are many solutions to this and I could fix this case 
easily but my code base is so huge at this point and I've used this process 
a lot, I have no confidence in upgrading from 1.4 if this is the case.

Thanks!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2cffb612-7a20-4402-9b27-2b0af2f73e13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django App DB replicas - call for suggestions

2015-02-24 Thread Blazor
Hi Cal (and all others),

>From what I can tell, you want to run a copy of the database on 
> multiple mini devices and have replication between them? 


I think I've actually made myself not perfectly clear. My plan would be to 
have a local portable django server for letting all the tablets in a LAN 
(the only clients existing for it) access this local central information 
repository even when an outside internet connection is not available and 
let this portable server sync to the central remote storage whenever it can 
reach it. At the same time someone from the outside might edit the very 
same models directly in the remote repository. An automatic mechanism would 
be in place to compute deltas and merge changes from both: once over, both 
DBs would have the same data inside.
 

> If so, this 
> isn't really a good use case for replication, and adds several 
> unnecessary layers of complexity.


Even though starting from preconditions not totally matching with the real 
use case, this conclusion equally holds true ;-)
 

> So lets look at the end goal, you 
> want multiple clients to have read/write access to the same data, with 
> the constraint that the internet connection will be unreliable, but 
> you still want the data to be accessible, and possibly, editable. 
>

Exactly.
 

>
> This can be easily achieved by implementing good development 
> practises,

[...]

simple and clean 
> implementation of such a structure. 
>

I'm not sure I see the connection here. Native mobile apps and/or html5 
clients can leverage local storage strategies to be properly synchronized 
as soon as the connection is available. This would totally make sense in a 
context in which each CUD (not considering read here, since it's not much 
of a problem) operation is related to "personal non-shared" data only. The 
problem, here, is that more than one client will almost always perform some 
modifications to the same models, so your next point is not an exception, 
it's the rule.
 

> To achieve this, you also have to consider conflict handling, for 
> [...] 

quite simple, at least once you get past all the academic stuff, the 
> hard part is exposing it to the user in a friendly way. 
>

And this is exactly the problem I'm trying to face here. My original 
purpose was to understand whether there's any out-of-the-box solution 
managing a "dual-master" synchronization in django.
I found this [1], but besides requiring a patch to the Postgres 9.4 code 
base, is not yet considered production-ready.
 

> You can get around many of these problems by disabling edits unless 
> there is an internet connection, allowing only read access in the 
> event of a connection drop out, then using model caching on the client 
> side (along with a bulk retrieve request).


By using a local django repository (local meaning  within the local 
wireless network among the tablets) I would get totally rid of the 
synchronization and notifications problems among all the native and/or 
html5 clients, moving the synchronization problem between the two databases 
only (the local and the remote one). Whether this would be an actual 
improvement or not, I'd have some more experienced user to decide.
 

> However both approaches 
> come with the same problem of delta changes, if a model changes then 
> each app will need to be notified about this, ideally via a push 
> mechanism. 


I am not an expert in this field and I'm afraid it would require a lot of 
time to design a proper merging mechanism.
 

> Designing an events system around this can be quite 
> challenging, for even the most seasoned developers. 
>

I get that.
 

> If you have enough time/resources then it could be a fantastic 
> learning experience for you, but if this is a quick/dirty project 
> primarily lead by billable hours, then you probably don't want to 
> follow this route. If someone sent me a spec like this, I'd say it 
> would *easily* be 300+ hours work. 
>

I'd like a quick and clean solution here ;-), since I have not enough time 
to follow all the required learning curve but I will be required to 
maintain and improve this project, so I'd rather pick a scalable solution 
from the beginning.
 

>
> Hope this helps, if I have misunderstood, let me know. 
>

It helps a lot, thanks for your time!
B.

[1] https://wiki.postgresql.org/wiki/BDR_User_Guide

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2c0913dc-7864-4a2a-86c5-e264d854a780%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django deployment in a virtual machine.

2015-02-24 Thread dk
its just a website with one link =)
basicly shows one graph. and that's it.

On Tuesday, February 24, 2015 at 3:41:14 PM UTC-6, george wrote:

> not production i hope.
>
> in prod use nginx. if not on prod use runserver 0.0.0.0:8000
> Em 24/02/2015 18:37, "dk" > escreveu:
>
>> I got a virtual machine with Linux centos that we are going to use for 
>> our django webpage.  
>> that machine will have the html service on. so when people go to the 
>> computer typing the IP, will show them the webpage. is there any special 
>> trick to do? like make a service that lunch manage.py with the runserver 
>> command?
>> if any one can point me to a webpage I will appreciate.
>>
>> thanks guys.
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e3255fbf-27c2-4ac5-bec6-939b9a8744cd%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bf9c8f15-7206-4932-95c9-d5c8bc82af9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django deployment in a virtual machine.

2015-02-24 Thread George Silva
not production i hope.

in prod use nginx. if not on prod use runserver 0.0.0.0:8000
Em 24/02/2015 18:37, "dk"  escreveu:

> I got a virtual machine with Linux centos that we are going to use for our
> django webpage.
> that machine will have the html service on. so when people go to the
> computer typing the IP, will show them the webpage. is there any special
> trick to do? like make a service that lunch manage.py with the runserver
> command?
> if any one can point me to a webpage I will appreciate.
>
> thanks guys.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e3255fbf-27c2-4ac5-bec6-939b9a8744cd%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGyPVTufYFmrBfP%3DO7%3DCsmOJTocginHZq%2BUSxdnGu5zZpq9XaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django deployment in a virtual machine.

2015-02-24 Thread dk
I got a virtual machine with Linux centos that we are going to use for our 
django webpage.  
that machine will have the html service on. so when people go to the 
computer typing the IP, will show them the webpage. is there any special 
trick to do? like make a service that lunch manage.py with the runserver 
command?
if any one can point me to a webpage I will appreciate.

thanks guys.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e3255fbf-27c2-4ac5-bec6-939b9a8744cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django GUI Frameworks?

2015-02-24 Thread ThomasTheDjangoFan
Hi ya,

I wonder if Django has any gui-frameworks which give common solutions for 
handling frontend data, p.e. in combination with Twitter Bootstrap?
Some time ago I had a look at the YII PHP Framework and they have a great 
solution called Yiibooster (check it out 
at http://yiibooster.clevertech.biz/jsonGridView).

Yiibooster offers a lot of widgets - all in one framework.
Is there anything like this for django?

Do you guys have some tips?

Kind regards
Thomas

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c9d58d24-a261-471f-9157-6fdc5a136158%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [solved] Migrating to initial migration: "ORA-00955: name is already used by an existing object"

2015-02-24 Thread Carsten Fuchs

Hi all,

it seems like I found the culprit, along with a simple solution:
https://code.djangoproject.com/ticket/24407

:-)

Best regards,
Carsten

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54ECBA0D.6090501%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Why am I getting ValueError: Unable to configure logger 'django_request': Unable to add handler 'request_handler': 'request_handler'?

2015-02-24 Thread Deanna Robertazzi
I am making a Django site and when I run ./manage.py shell, I get this 
traceback: 

/home/deanna/django_test/static/
Traceback (most recent call last):
  File "./manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/home/deanna/django-deanna/local/lib/python2.7/site-packages/Django-1.7.4-py2.7.egg/django/core/management/__init__.py",
 
line 385, in execute_from_command_line
utility.execute()
  File 
"/home/deanna/django-deanna/local/lib/python2.7/site-packages/Django-1.7.4-py2.7.egg/django/core/management/__init__.py",
 
line 354, in execute
django.setup()
  File 
"/home/deanna/django-deanna/local/lib/python2.7/site-packages/Django-1.7.4-py2.7.egg/django/__init__.py",
 
line 20, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File 
"/home/deanna/django-deanna/local/lib/python2.7/site-packages/Django-1.7.4-py2.7.egg/django/utils/log.py",
 
line 87, in configure_logging
logging_config_func(logging_settings)
  File "/usr/lib/python2.7/logging/config.py", line 794, in dictConfig
dictConfigClass(config).configure()
  File "/usr/lib/python2.7/logging/config.py", line 627, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure logger 'django_request': Unable to add 
handler 'request_handler': 'request_handler'


This is my Procfile: 

web: gunicorn django_test.wsgi
I have attached manage.py and settings.py files to this post. 

 I'd greatly appreciate any help you can give me. Thank you. 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f8f86b57-747e-45f5-9ca4-f593f3b6c9b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_test.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
import dj_database_url 

PROJECT_DIRECTORY = os.getcwd()
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'n%_s8-xtab-idlj8*mmny7uzf73@x%nvqrsqbf&(%jf_khu+7v'

# List of callables that know how to import templates from various sources. 
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
#   'django.template.loaders.eggs.Loader',
)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False 
#TEMPLATE_DEBUG = DEBUG
TEMPLATE_DEBUG = True

ADMINS = (
('Deanna Robertazzi', 'deanna.roberta...@gmail.com')
)

MANAGERS = ADMINS 

ALLOWED_HOSTS = []

EMAIL_HOST = 'localhost'
# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.comments',
'article',
'tastypie',
'django.contrib.formtools',
'userprofile',
'storages',
'gunicorn',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins':{
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'filters': ['require_debug_false'],
}
},
'loggers': {
 'django.request': {
 'handlers': ['mail_admins'],
 'level': 'ERROR',
 'propogate': True,
 },
}
}
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
#'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'django_test.urls'

WSGI_APPLICATION = 'django_test.wsgi.application'

TEMPLATE_DIRS = ('/home/deanna/django_test/templates',
 'home/deanna/django_test/articles/templates',)


# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

DATABASES = {
'default': dj_database_url.config()


#'default': { #Good for offline work
#'ENGINE': 'django.db.backends.sqlite3'

Re: OperationalError: ORA-03114: not connected to ORACLE.

2015-02-24 Thread Andreas Kuhne
The file you wrote connects to the database itself, it doesn't use djangos
connection, so the only thing you are testing is if you can connect to the
database. And that we know (because you are able to do it with ./manage.py
dbshell). What you need to check is if the settings.py file used by django
is correctly interpreted by mod_wsgi.

Because you are bepassing all of that, your test file will work and just
connects to the database.

As I said earlier, make sure that your mod_wsgi is configured correctly and
that it can read your settings file.

Regards,

Andréas

2015-02-24 16:19 GMT+01:00 :

> Well i have created the below test script to check if i am able to connect
> to the DB using mod_wsgi and i get back the sysdate from the DB.. I have
> configured mod_wsgi under the alias /test to execute the below script and i
> always get the time..  So it seems that the configuration in mod_wsgi is
> correct
> 
> import os,sys
>
> import cx_Oracle
>
>
> con = cx_Oracle.connect("username/password@DB")
> print('DATABASE VERSION: ' + con.version)
> print ''
>
> time= con.cursor()
> time.execute("SELECT TO_CHAR (SYSDATE, 'MM-DD- HH24:MI:SS') FROM DUAL")
>
> for t in time:
> print t
>
> con.close()
>
> def application(environ, start_response):
> status = '200 OK'
> output = 'Hello World! \r\r'
> output += str(t)
> #print sys.stderr
>
> response_headers = [('Content-type', 'text/plain'),
> ('Content-Length', str(len(output)))]
>
> start_response(status, response_headers)
>
> return [output]
>
>
> -
>
>
> On Tuesday, February 24, 2015 at 4:21:01 PM UTC+2, Andréas Kühne wrote:
>>
>> Hmmm
>>
>> You can use ./manage.py dbshell, so your configuration is correct in THAT
>> case, however, have you set all the variables correctly for django when
>> running apache + mod_wsgi? Has the connection ever worked there?
>>
>> What do the config files for mod_wsgi look like and are all of the paths
>> correctly set in the mod_wsgi script?
>>
>> I'm just guessing now, but I think that the problem is your mod_wsgi
>> setup.
>>
>> Regards,
>>
>> Andréas
>>
>> 2015-02-24 14:17 GMT+01:00 :
>>
>>> Is there any way to find out where the problem occurs ?? Is there a way
>>> to enable some debugging or trace in order to see which python scripts are
>>> called in Django and find out where the whole process is failing ??
>>>
>>> In the last lines of the stack trace it tries to close the connection
>>> and for some reason it fails... is it because the connection was never
>>> created ?? or it was closed before the application was ready to send data..
>>> ???
>>>
>>> Can anyone help 
>>>
>>> On Tuesday, February 24, 2015 at 2:08:53 PM UTC+2, Andréas Kühne wrote:

 The reason I asked this is because that means that your connection
 parameters are correct, so it should work?

 Sorry I don't know what to do to help you more.

 Regards,

 Andréas

 2015-02-24 12:49 GMT+01:00 :

> Hi Andreas,
>
> I can connect using "python manage.py dbshell" it connects without any
> error.
>
> Is there a difference, if i am not mistaken the dbshell test shows
> that the configuration of the DB is correct and that i can connect from 
> the
> machine, correct ?? From the stack trace it seems that the real issue is
> not returned and the only thing i get is the "NOT CONNECTED TO ORACLE" 
> error
>
>
> Regards,
> Alex
>
> On Friday, February 20, 2015 at 7:12:05 PM UTC+2, Andréas Kühne wrote:
>>
>>
>> 2015-02-20 17:18 GMT+01:00 :
>>
>>> Hi,
>>>
>>> I migrated my project to a new infrastructure but i kept the same
>>> versions Apache 2.2 + mod_wsgi + python 2.6.1 + Django 1.2.1
>>>
>>> I am trying to run my project and i am getting the below exception
>>> that seems to be from Django and i need help pin pointing the exact 
>>> cause,
>>> because i think that the actual exception is never caught and returned 
>>> to
>>> the log and all i am getting is the OperationalError: ORA-03114: not
>>> connected to ORACLE. I checked the Oracle DB and i can connect to it.
>>>
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] mod_wsgi
>>> (pid=27565): Exception occurred processing WSGI script
>>> '/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi'.
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Traceback
>>> (most recent call last):
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
>>> "/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi", line 50,
>>> in __call__
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] return
>>> self.__application(environ, _start_response)
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
>>> "/opt/webtier/python_64/lib/python2.6/site-p

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-24 Thread C. Kirby
I'm sorry I missed this thread at the beginning. I have an app that 
basically gives you the ability to build "advanced search" forms in almost 
the same way as model forms. You can take a look at it at 
https://github.com/ckirby/django-modelqueryform

If you try it or at least look at it, please let me know what you think. I 
am successfully using it in 3 different projects.

Best,
Kirby

On Monday, February 23, 2015 at 6:33:32 PM UTC-6, Vijay Khemlani wrote:
>
> You're welcome, glad I could help :D
>
> On Mon, Feb 23, 2015 at 5:25 PM, Ronaldo Bahia  > wrote:
>
>> Awesome! Now it works perfectly.
>>
>> I'm updating my stackoverflow code for anyone facing the same doubt.
>>
>> Thanks a lot man
>>
>>
>> Em segunda-feira, 23 de fevereiro de 2015 13:02:06 UTC-3, Vijay Khemlani 
>> escreveu:
>>>
>>> Change the declaration of the funciotn
>>>
>>> def filter_job_candidates(job):
>>>
>>> to
>>>
>>> def filter_job_candidates(self, job):
>>>
>>> And the filtering depends on the particular job being displayed on the 
>>> view, if you change the line to
>>>
>>> Job.objects.applied_to.all()
>>>
>>> Then it would filter the candidates for all the jobs, not the particular 
>>> one the user is seeing on the view (the one that is passed to the form 
>>> method).
>>>
>>>
>>>
>>>
>>> On Mon, Feb 23, 2015 at 12:31 PM, Ronaldo Bahia  
>>> wrote:
>>>
 Oh, I'm feeling stupid right now :D

 now my new error:

 filter_job_candidates() takes exactly 1 argument (2 given)

 in views.py

 job_candidates = form_cand.filter_job_candidates(self.object)

 I've tried to remove the arguments but django says "global name 'self' 
 not defined"

 I also think that in forms.py the correct way to write is:

 def filter_job_candidates(job):
 assert self.is_valid()
  job_candidates = Job.objects.applied_to.all()

 Or am I wrong?

 Sorry for bothering...



 Em segunda-feira, 23 de fevereiro de 2015 10:50:49 UTC-3, Vijay 
 Khemlani escreveu:
>
> Oh, if it is that line I missed a parenthesis in the my previuos 
> snippet in the filter of haircolor
>
> job_candidates = job_candidates.filter(candidate__candidatelook__
> haircolor=self.cleaned_data['haircolor'])
>
> You also need to change the other filter
>
> job_candidates = job_candidates.filter(status=s
> elf.cleaned_data['status'])
>
> But you should ble able to detect that kind of errors, those are 
> Python things, not something specifically about Django.
>
>
>
>
> On Mon, Feb 23, 2015 at 7:40 AM, Ronaldo Bahia  
> wrote:
>
>> I have just updated my code in stackoverflow:
>> http://stackoverflow.com/questions/28637326/how-to-filter-
>> results-using-forms-in-django-best-approach
>>
>> *Ronaldo Bahia *
>> Diretor | JobConvo.com
>> Tel: 11 3280 6971
>>
>> 2015-02-22 23:16 GMT-03:00 Vijay Khemlani :
>>
>>> Well, I think you can continue posting the updated code here or 
>>> pastebin or in the stackoverflow question, where other people can 
>>> suggest 
>>> solutions.
>>>
>>> What is the complete message you are getting in your syntax error? 
>>> can you upload your whole forms.py into pastebin or something?
>>>
>>> Regards
>>>
>>> On Sun, Feb 22, 2015 at 10:53 PM, Ronaldo Bahia >> > wrote:
>>>
 Vijay,

 For some reason, I'm getting SyntaxError with self.cleaned_data in 
 forms.py 

 I'd like you to teach me how to make this. I have no problem to 
 share my project code.

 Do you think we can make it?

 Please, email me so we can discuss about it or add me in skype: 
 bahiamartins

 Thanks very much

 Em sábado, 21 de fevereiro de 2015 20:49:21 UTC-2, Vijay Khemlani 
 escreveu:
>
> If both forms are used in the same view, I see little reason to 
> make them separate and ModelForms, the form class I put above should 
> be a 
> better choice.
>
> In order to do the actual filtering, you can do something like this
>
> class ScreeningForm(forms.Form):
> haircolor = 
> forms.ChoiceField(choices=CandidateLook.HAIRCOLOR_CHOICES, 
> required=False)
> status = forms.ChoiceField(choices=CandidateToJob.STATUS_CHOICES, 
> required=False)
>
> def filter_job_candidates(job):
> assert self.is_valid()
>
> job_candidates = job.applied_to.all().order_by(
> 'candidate')
>
> if self.cleaned_data['haircolor']:
> # You need to change the "user" field in CandidateLook 
> to a OneToOneField for this to work, which doesn't change anything 
> since 
> the f

Re: OperationalError: ORA-03114: not connected to ORACLE.

2015-02-24 Thread alexandrosstylianou88
Well i have created the below test script to check if i am able to connect 
to the DB using mod_wsgi and i get back the sysdate from the DB.. I have 
configured mod_wsgi under the alias /test to execute the below script and i 
always get the time..  So it seems that the configuration in mod_wsgi is 
correct 

import os,sys

import cx_Oracle


con = cx_Oracle.connect("username/password@DB")
print('DATABASE VERSION: ' + con.version)
print ''

time= con.cursor()
time.execute("SELECT TO_CHAR (SYSDATE, 'MM-DD- HH24:MI:SS') FROM DUAL")

for t in time:
print t

con.close()

def application(environ, start_response):
status = '200 OK'
output = 'Hello World! \r\r'
output += str(t)
#print sys.stderr

response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]

start_response(status, response_headers)

return [output]


-


On Tuesday, February 24, 2015 at 4:21:01 PM UTC+2, Andréas Kühne wrote:
>
> Hmmm
>
> You can use ./manage.py dbshell, so your configuration is correct in THAT 
> case, however, have you set all the variables correctly for django when 
> running apache + mod_wsgi? Has the connection ever worked there?
>
> What do the config files for mod_wsgi look like and are all of the paths 
> correctly set in the mod_wsgi script?
>
> I'm just guessing now, but I think that the problem is your mod_wsgi setup.
>
> Regards,
>
> Andréas 
>
> 2015-02-24 14:17 GMT+01:00 >:
>
>> Is there any way to find out where the problem occurs ?? Is there a way 
>> to enable some debugging or trace in order to see which python scripts are 
>> called in Django and find out where the whole process is failing ?? 
>>
>> In the last lines of the stack trace it tries to close the connection and 
>> for some reason it fails... is it because the connection was never created 
>> ?? or it was closed before the application was ready to send data.. ??? 
>>
>> Can anyone help  
>>
>> On Tuesday, February 24, 2015 at 2:08:53 PM UTC+2, Andréas Kühne wrote:
>>>
>>> The reason I asked this is because that means that your connection 
>>> parameters are correct, so it should work?
>>>
>>> Sorry I don't know what to do to help you more.
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>> 2015-02-24 12:49 GMT+01:00 :
>>>
 Hi Andreas, 

 I can connect using "python manage.py dbshell" it connects without any 
 error. 

 Is there a difference, if i am not mistaken the dbshell test shows that 
 the configuration of the DB is correct and that i can connect from the 
 machine, correct ?? From the stack trace it seems that the real issue is 
 not returned and the only thing i get is the "NOT CONNECTED TO ORACLE" 
 error


 Regards,
 Alex

 On Friday, February 20, 2015 at 7:12:05 PM UTC+2, Andréas Kühne wrote:
>
>
> 2015-02-20 17:18 GMT+01:00 :
>
>> Hi, 
>>
>> I migrated my project to a new infrastructure but i kept the same 
>> versions Apache 2.2 + mod_wsgi + python 2.6.1 + Django 1.2.1  
>>
>> I am trying to run my project and i am getting the below exception 
>> that seems to be from Django and i need help pin pointing the exact 
>> cause, 
>> because i think that the actual exception is never caught and returned 
>> to 
>> the log and all i am getting is the OperationalError: ORA-03114: not 
>> connected to ORACLE. I checked the Oracle DB and i can connect to it. 
>>
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] mod_wsgi 
>> (pid=27565): Exception occurred processing WSGI script 
>> '/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi'.
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Traceback 
>> (most recent call last):
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi", line 50, 
>> in __call__
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] return 
>> self.__application(environ, _start_response)
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
>>  
>> line 248, in __call__
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] 
>> signals.request_finished.send(sender=self.__class__)
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/
>> dispatch/dispatcher.py", line 162, in send
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] response 
>> = receiver(signal=self, sender=sender, **named)
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/db/__init__.py",
>>  
>> line 82, in close_connection
>>

Re: OperationalError: ORA-03114: not connected to ORACLE.

2015-02-24 Thread Andreas Kuhne
Hmmm

You can use ./manage.py dbshell, so your configuration is correct in THAT
case, however, have you set all the variables correctly for django when
running apache + mod_wsgi? Has the connection ever worked there?

What do the config files for mod_wsgi look like and are all of the paths
correctly set in the mod_wsgi script?

I'm just guessing now, but I think that the problem is your mod_wsgi setup.

Regards,

Andréas

2015-02-24 14:17 GMT+01:00 :

> Is there any way to find out where the problem occurs ?? Is there a way to
> enable some debugging or trace in order to see which python scripts are
> called in Django and find out where the whole process is failing ??
>
> In the last lines of the stack trace it tries to close the connection and
> for some reason it fails... is it because the connection was never created
> ?? or it was closed before the application was ready to send data.. ???
>
> Can anyone help 
>
> On Tuesday, February 24, 2015 at 2:08:53 PM UTC+2, Andréas Kühne wrote:
>>
>> The reason I asked this is because that means that your connection
>> parameters are correct, so it should work?
>>
>> Sorry I don't know what to do to help you more.
>>
>> Regards,
>>
>> Andréas
>>
>> 2015-02-24 12:49 GMT+01:00 :
>>
>>> Hi Andreas,
>>>
>>> I can connect using "python manage.py dbshell" it connects without any
>>> error.
>>>
>>> Is there a difference, if i am not mistaken the dbshell test shows that
>>> the configuration of the DB is correct and that i can connect from the
>>> machine, correct ?? From the stack trace it seems that the real issue is
>>> not returned and the only thing i get is the "NOT CONNECTED TO ORACLE" error
>>>
>>>
>>> Regards,
>>> Alex
>>>
>>> On Friday, February 20, 2015 at 7:12:05 PM UTC+2, Andréas Kühne wrote:


 2015-02-20 17:18 GMT+01:00 :

> Hi,
>
> I migrated my project to a new infrastructure but i kept the same
> versions Apache 2.2 + mod_wsgi + python 2.6.1 + Django 1.2.1
>
> I am trying to run my project and i am getting the below exception
> that seems to be from Django and i need help pin pointing the exact cause,
> because i think that the actual exception is never caught and returned to
> the log and all i am getting is the OperationalError: ORA-03114: not
> connected to ORACLE. I checked the Oracle DB and i can connect to it.
>
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] mod_wsgi
> (pid=27565): Exception occurred processing WSGI script
> '/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi'.
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Traceback
> (most recent call last):
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
> "/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi", line 50,
> in __call__
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] return
> self.__application(environ, _start_response)
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
> "/opt/webtier/python_64/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
> line 248, in __call__
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
> signals.request_finished.send(sender=self.__class__)
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
> "/opt/webtier/python_64/lib/python2.6/site-packages/django/
> dispatch/dispatcher.py", line 162, in send
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] response =
> receiver(signal=self, sender=sender, **named)
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
> "/opt/webtier/python_64/lib/python2.6/site-packages/django/db/__init__.py",
> line 82, in close_connection
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
> conn.close()
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
> "/opt/webtier/python_64/lib/python2.6/site-packages/django/
> db/backends/__init__.py", line 70, in close
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
> self.connection.close()
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
> OperationalError: ORA-03114: not connected to ORACLE
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Request Failed
> for : /wgtproxy/admin/, Resp Code : [500]
>
>  --
> 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...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/88d2de85-f330-4c35-9818-9c19addcc1cf%40goog
> legroups.com
> <

Index(View) rendering template instead of view

2015-02-24 Thread Brad Rice
So I have a RedirectView.as_view() going to a page in an app called web.

In the app web this is my view:

class Index(View):

def get(self, request, *args, **kwargs):
return HttpResponse('Hello, World!')

However, instead of showing that, when I get redirected to the app it shows 
my base template and index template even though I have not specified them 
in my Index view. It appears my url is not hitting the view.

Here is my urls.py in web: 

from django.conf.urls import *
import os
from .views import Index, gallery

urlpatterns = patterns('',
url(r'^$', Index.as_view(), name='index'),
url(r'^gallery', gallery, name='gallery'),
)

Here is the website: www.lodiharrisvillehistorical.org

notice it going to /web but not echoing out Hello, World!

also notice gallery is working and finding the view.

Why is it not picking up the Index view and instead displaying a template 
with no context?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc79434f-bf1a-4549-9708-0d5cf40439d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django sometimes shows partial (incomplete) json data in production env

2015-02-24 Thread Javier Guerra Giraldez
On Mon, Feb 23, 2015 at 11:54 PM, George Mejia  wrote:
>
> Besides, this only happens on production env ...  The code is fine and works 
> on production env, and the behaviour was normal before ...  this also happens 
> for others queries (all only in production), I wonder what is cutting 
> conexion ? if so, when this occurs ?


check the time needed to generate that response.  this sounds like
some serve-enforced timeout.

(why to send textual data as a picture??)


-- 
Javier

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoTTU%2B75G1uUMmK5Uhq-i4QOuYTKBgtUeMGSx52uzJu_fA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using class based views.

2015-02-24 Thread Javier Guerra Giraldez
On Tue, Feb 24, 2015 at 1:51 AM, James Schneider
 wrote:
> However, if you have working view functions, what is the"need" to switch to
> CBV's?


this.

the switch to CBV, wasn't "modern Django views are classes instead of
functions; Get rid of your functions!, FBV are dead!".   Instead it's
just that _generic_ views weren't useful enough, and to make them more
extensively configurable, they were transformed into a very capable,
albeit complex, set of classes.

all this is just for the included generic views, for your own views
just do whatever you find appropriate to structure your code and, in
the end, present a callable to the url() routing structures.

If you have too much repeated code, by all means factor it out; either
into supporting functions, or turn your views into objects, or
classes, anything you like.  But even if you decide to do some CBV,
there's no need to use the included classes, as they're unlikely to be
the best answer outside of the 'generic view' envelope.

-- 
Javier

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoR%2BPhV5mEAG%3DGWVnqcyRJbLBJ%2BnQUXdRJujED6RdKF-2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: OperationalError: ORA-03114: not connected to ORACLE.

2015-02-24 Thread alexandrosstylianou88
Is there any way to find out where the problem occurs ?? Is there a way to 
enable some debugging or trace in order to see which python scripts are 
called in Django and find out where the whole process is failing ?? 

In the last lines of the stack trace it tries to close the connection and 
for some reason it fails... is it because the connection was never created 
?? or it was closed before the application was ready to send data.. ??? 

Can anyone help  

On Tuesday, February 24, 2015 at 2:08:53 PM UTC+2, Andréas Kühne wrote:
>
> The reason I asked this is because that means that your connection 
> parameters are correct, so it should work?
>
> Sorry I don't know what to do to help you more.
>
> Regards,
>
> Andréas
>
> 2015-02-24 12:49 GMT+01:00 >:
>
>> Hi Andreas, 
>>
>> I can connect using "python manage.py dbshell" it connects without any 
>> error. 
>>
>> Is there a difference, if i am not mistaken the dbshell test shows that 
>> the configuration of the DB is correct and that i can connect from the 
>> machine, correct ?? From the stack trace it seems that the real issue is 
>> not returned and the only thing i get is the "NOT CONNECTED TO ORACLE" error
>>
>>
>> Regards,
>> Alex
>>
>> On Friday, February 20, 2015 at 7:12:05 PM UTC+2, Andréas Kühne wrote:
>>>
>>>
>>> 2015-02-20 17:18 GMT+01:00 :
>>>
 Hi, 

 I migrated my project to a new infrastructure but i kept the same 
 versions Apache 2.2 + mod_wsgi + python 2.6.1 + Django 1.2.1  

 I am trying to run my project and i am getting the below exception that 
 seems to be from Django and i need help pin pointing the exact cause, 
 because i think that the actual exception is never caught and returned to 
 the log and all i am getting is the OperationalError: ORA-03114: not 
 connected to ORACLE. I checked the Oracle DB and i can connect to it. 

 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] mod_wsgi 
 (pid=27565): Exception occurred processing WSGI script 
 '/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi'.
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Traceback (most 
 recent call last):
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
 "/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi", line 50, in 
 __call__
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] return 
 self.__application(environ, _start_response)
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
 "/opt/webtier/python_64/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
  
 line 248, in __call__
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] 
 signals.request_finished.send(sender=self.__class__)
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
 "/opt/webtier/python_64/lib/python2.6/site-packages/
 django/dispatch/dispatcher.py", line 162, in send
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] response = 
 receiver(signal=self, sender=sender, **named)
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
 "/opt/webtier/python_64/lib/python2.6/site-packages/django/db/__init__.py",
  
 line 82, in close_connection
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] conn.close()
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
 "/opt/webtier/python_64/lib/python2.6/site-packages/
 django/db/backends/__init__.py", line 70, in close
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] 
 self.connection.close()
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] 
 OperationalError: ORA-03114: not connected to ORACLE
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] 
 [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Request Failed 
 for : /wgtproxy/admin/, Resp Code : [500]

  -- 
 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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/django-users/88d2de85-f330-4c35-9818-9c19addcc1cf%
 40googlegroups.com 
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> What happens if you try to do "python manage.py dbshell"? Are you able 
>>> to connect to the database then?
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe 

Re: OperationalError: ORA-03114: not connected to ORACLE.

2015-02-24 Thread Andreas Kuhne
The reason I asked this is because that means that your connection
parameters are correct, so it should work?

Sorry I don't know what to do to help you more.

Regards,

Andréas

2015-02-24 12:49 GMT+01:00 :

> Hi Andreas,
>
> I can connect using "python manage.py dbshell" it connects without any
> error.
>
> Is there a difference, if i am not mistaken the dbshell test shows that
> the configuration of the DB is correct and that i can connect from the
> machine, correct ?? From the stack trace it seems that the real issue is
> not returned and the only thing i get is the "NOT CONNECTED TO ORACLE" error
>
>
> Regards,
> Alex
>
> On Friday, February 20, 2015 at 7:12:05 PM UTC+2, Andréas Kühne wrote:
>>
>>
>> 2015-02-20 17:18 GMT+01:00 :
>>
>>> Hi,
>>>
>>> I migrated my project to a new infrastructure but i kept the same
>>> versions Apache 2.2 + mod_wsgi + python 2.6.1 + Django 1.2.1
>>>
>>> I am trying to run my project and i am getting the below exception that
>>> seems to be from Django and i need help pin pointing the exact cause,
>>> because i think that the actual exception is never caught and returned to
>>> the log and all i am getting is the OperationalError: ORA-03114: not
>>> connected to ORACLE. I checked the Oracle DB and i can connect to it.
>>>
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] mod_wsgi
>>> (pid=27565): Exception occurred processing WSGI script
>>> '/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi'.
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Traceback (most
>>> recent call last):
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
>>> "/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi", line 50, in
>>> __call__
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] return
>>> self.__application(environ, _start_response)
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
>>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
>>> line 248, in __call__
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
>>> signals.request_finished.send(sender=self.__class__)
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
>>> "/opt/webtier/python_64/lib/python2.6/site-packages/
>>> django/dispatch/dispatcher.py", line 162, in send
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] response =
>>> receiver(signal=self, sender=sender, **named)
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
>>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/db/__init__.py",
>>> line 82, in close_connection
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] conn.close()
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File
>>> "/opt/webtier/python_64/lib/python2.6/site-packages/
>>> django/db/backends/__init__.py", line 70, in close
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
>>> self.connection.close()
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
>>> OperationalError: ORA-03114: not connected to ORACLE
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]
>>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Request Failed
>>> for : /wgtproxy/admin/, Resp Code : [500]
>>>
>>>  --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/88d2de85-f330-4c35-9818-9c19addcc1cf%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> What happens if you try to do "python manage.py dbshell"? Are you able to
>> connect to the database then?
>>
>> Regards,
>>
>> Andréas
>>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/71056041-36f4-4392-9303-4775dc80a510%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.

Django sometimes shows partial (incomplete) json data in production env

2015-02-24 Thread George Mejia
I request some json data by some url, sometimes it works fine and *sometimes 
doesn't* ... I looked another related cuestion here 
, but it 
seems to recommend not change content-length by middleware ... my json data 
incomplete is as image below shows:





Besides, this only happens on production env ...  The code is fine and 
works on production env, and the behaviour was normal before ...  this also 
happens for others queries (all only in production), I wonder what is 
cutting conexion ? if so, when this occurs ?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a2f5d39a-3b4c-4c37-bc4d-88e3e664be5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: modelFormSet and csrf

2015-02-24 Thread joulu tervehdys
Hi,Yes csrf was missing, but got it working by changing render_to_response
to render.
Surprising that example code was not designed to work as such

Still I would like to get action buttons for each row. Admin view has at
least some kind of links in each row.
-thanks

2015-02-24 12:52 GMT+02:00 aRkadeFR :

>  Please, print your variable request.POST on your
> view and see if the csrf_token is missing or not?
> Same for your formset variable :)
>
>
> On 02/24/2015 09:55 AM, joulumaa wrote:
>
> Thanks, but I did exactly that and still 403 csrf error, attached my
> template and related code
> thanks for help
>
> 
> {% csrf_token %}
> 
> {{ formset }}
> 
>  
> 
>
> def school(request):
> SchoolFormSet = modelformset_factory(SchoolHistory)
> if request.method == 'post':
> formset = SchoolFormSetSet(request.POST, request.FILES)
> if formset.is_valid():
> formset.save()
> # do something.
> else:
> formset = SchoolFormSet()
> return render_to_response("testformset.html", {
> "formset": formset,
> })
>
>
> tiistai 24. helmikuuta 2015 10.31.13 UTC+2 aRkadeFR kirjoitti:
>>
>>  Hello :)
>>
>> The template indeed doesn't show the submit button in the
>> documentation here:
>> https://docs.djangoproject.com/en/1.7/topics/forms/
>> formsets/#using-a-formset-in-views-and-templates
>>
>> In order to add the csrf token, you can use the template tag
>> {% csrf %} inside the form tag.
>> And add the submit button before closing the form tag too :)
>>
>> On 02/24/2015 01:09 AM, joulumaa wrote:
>>
>> Hi,
>> I just studied and created first modelFormSet, and tried to use it in
>> view.
>> I have same code in template as is in django documentation.
>> modelFormset shows data ok, but submit button is missing,why it is not in
>> example template in documentation?
>> ok, I added submit button like I have used with basic forms, it shows up
>> but cause csrf error,
>> then I added csrf tag as in form cases before, but still csrf  error
>>
>> I am missing some information i guess???, any help for beginner...?
>>
>> -Vesa
>> btw, i would like to have that saving button on each row in formset
>> is it possible?
>>  --
>> 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...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/ee930575-0a61-4c74-ad34-847df414f59c%
>> 40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPHgOn5h873--AHkvFTzQfmdC0XWjFvZj-zQ8tJRXpnAUs2wAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: OperationalError: ORA-03114: not connected to ORACLE.

2015-02-24 Thread alexandrosstylianou88
Hi Andreas, 

I can connect using "python manage.py dbshell" it connects without any 
error. 

Is there a difference, if i am not mistaken the dbshell test shows that the 
configuration of the DB is correct and that i can connect from the machine, 
correct ?? From the stack trace it seems that the real issue is not 
returned and the only thing i get is the "NOT CONNECTED TO ORACLE" error


Regards,
Alex

On Friday, February 20, 2015 at 7:12:05 PM UTC+2, Andréas Kühne wrote:
>
>
> 2015-02-20 17:18 GMT+01:00 >:
>
>> Hi, 
>>
>> I migrated my project to a new infrastructure but i kept the same 
>> versions Apache 2.2 + mod_wsgi + python 2.6.1 + Django 1.2.1  
>>
>> I am trying to run my project and i am getting the below exception that 
>> seems to be from Django and i need help pin pointing the exact cause, 
>> because i think that the actual exception is never caught and returned to 
>> the log and all i am getting is the OperationalError: ORA-03114: not 
>> connected to ORACLE. I checked the Oracle DB and i can connect to it. 
>>
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] mod_wsgi 
>> (pid=27565): Exception occurred processing WSGI script 
>> '/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi'.
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Traceback (most 
>> recent call last):
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi", line 50, in 
>> __call__
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] return 
>> self.__application(environ, _start_response)
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
>>  
>> line 248, in __call__
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] 
>> signals.request_finished.send(sender=self.__class__)
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/dispatch/dispatcher.py",
>>  
>> line 162, in send
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] response = 
>> receiver(signal=self, sender=sender, **named)
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/db/__init__.py", 
>> line 82, in close_connection
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] conn.close()
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx]   File 
>> "/opt/webtier/python_64/lib/python2.6/site-packages/django/db/backends/__init__.py",
>>  
>> line 70, in close
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] 
>> self.connection.close()
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] OperationalError: 
>> ORA-03114: not connected to ORACLE
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] 
>> [Fri Feb 20 17:40:51 2015] [error] [client xx.xx.xx.xx] Request Failed 
>> for : /wgtproxy/admin/, Resp Code : [500]
>>
>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/88d2de85-f330-4c35-9818-9c19addcc1cf%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> What happens if you try to do "python manage.py dbshell"? Are you able to 
> connect to the database then?
>
> Regards,
>
> Andréas
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/71056041-36f4-4392-9303-4775dc80a510%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Edx LDAP Auth setting

2015-02-24 Thread Mario Gudelj
To check the version go to shell and run this:

>>> import django_auth_ldap

>>> django_auth_ldap.version

(1, 1, 2)

>>>

As for virtualenv, it's a good practice but it's not necessary.

By the way, have you tried performing a simple search on the LDAP server? I
think that your best bet is to start with python-ldap (forget about
django_auth_ldap), try to connect to the server, perform a bind and get a
feel for it.

I normally open the shell and run something like this in it
https://bpaste.net/show/d4348eb1b3dd

You have to know the following:

- protocol (secure or not)

- IP or domain name of the LDAP server

- port

- A full DN of one of the users would be useful but once you establish the
connection you can figure this out.

I remember that I was using Django 1.5.x and django_auth_ldap was still
using User model by default. Not sure if that's still the case but you may
have to patch it.

Good luck!

M









On 24 February 2015 at 17:37, 'Yip Terence' via Django users <
django-users@googlegroups.com> wrote:

> Hi L,
>
>
>
> Thanks for your reply.
>
>
>
> I’m through pip to install the django-auth-ldap already.  But there are
> two question here.
>
> 1.   How can I check the django-auth-ldap version?
>
> 2.   What do you mean of install via virt env? I’m follow the edX
> Ubuntu 12.04 +64 bit installation guide to install the edX, is that virt
> env?
>
>
> *https://github.com/edx/configuration/wiki/edX-Ubuntu-12.04-64-bit-Installation*
> 
>
>
>
>
> -
>
> root@ethiopia:/edx/app/edxapp/edx-platform/lms/envs# pip install
> django-auth-ldap
>
> Requirement already satisfied (use --upgrade to upgrade): django-auth-ldap
> in /usr/local/lib/python2.7/dist-packages
>
> Requirement already satisfied (use --upgrade to upgrade): django in
> /usr/local/lib/python2.7/dist-packages (from django-auth-ldap)
>
> Requirement already satisfied (use --upgrade to upgrade): python-ldap>=2.0
> in /usr/local/lib/python2.7/dist-packages (from django-auth-ldap)
>
> Requirement already satisfied (use --upgrade to upgrade): setuptools in
> /usr/local/lib/python2.7/dist-packages (from
> python-ldap>=2.0->django-auth-ldap)
>
> Cleaning up...
>
>
>
> Thanks and Regards,
>
> Terence Yip
>
> Lachlan Musicman於 2015年2月24日星期二 UTC+8上午7時15分46秒寫道:
>
>> Sorry, I've been organising a conference and have been awol. I'll be
>> able to take a look next week. But quickly:
>>
>> I don't understand why you have two versions of Django, I would
>> suggest that is an issue.
>>
>> You should be using django-auth-ldap, and that's got Django > 1.3 as a
>> requirement.
>>
>> You shouldn't need to create the %user - that is done automatically by
>> the django-auth-ldap
>>
>> Finally, please please please use a virtual environment. It makes all
>> of this significantly easier - like finding django-auth-ldap is as
>> easy as "pip install django-auth-ldap".
>>
>> It's recommended you don't install via apt-get. While apt-get is easy
>> and centralised, in the case of web apps, I would install via virt env
>> and pip every time.
>>
>> cheers
>> L.
>> --
>> "This is a profound psychological violence here. How can one even
>> begin to speak of dignity in labor when one secretly feels one's job
>> should not exist?"
>>
>> On the Phenomenon of Bullshit Jobs, David Graeber
>> http://strikemag.org/bullshit-jobs/
>>
>>
>> On 23 February 2015 at 19:09, 'Yip Terence' via Django users
>>  wrote:
>> > Hi L,
>> >
>> > Actually, I has been input the LDAP string in
>> > /edx/app/edxapp/edx-platform/lms/envs/common.py.  But there a two
>> problems
>> > after the configuration. Firstly, the script can't get the %user value
>> I
>> > need to hardcode the username / email in the connection string than I
>> can
>> > login to edx.  Secondly, can't to create an user profile when first
>> login.
>> >
>> > Is it need to modify the views.py and urls.py file for collect the
>> %user
>> > value and create the user profile?
>> >
>> >
>> > I have 2 version django in edx.
>> > ./edx/app/edxapp/venvs/edxapp/src/lettuce/tests/integration/
>> lib/Django-1.3/django/bin/django-admin.py
>> > ./edx/app/edxapp/venvs/edxapp/src/lettuce/tests/integration/
>> lib/Django-1.2.5/django/bin/django-admin.py
>> >
>> >
>> > ldap_auth_ldap:
>> > How can I find the version?  I using the apt-get to install the
>> package.
>> >
>> > The search settings.py result.
>> > ---Setttings.py---
>> > ./edx/app/xqueue/xqueue/xqueue/settings.py
>> > ./edx/app/xqueue/venvs/xqueue/lib/python2.7/site-packages/
>> django/conf/project_template/project_name/settings.py
>> > ./edx/app/xqueue/venvs/xqueue/lib/python2.7/site-packages/
>> newrelic-2.18.1.15/newrelic/api/settings.py
>> > ./edx/app/edxapp/edx-platform/common/test/acceptance/pages/studio/settings.py
>>
>> > ./edx/app/edxapp/edx-platform/lms/djangoapps/django_comment_c

Re: modelFormSet and csrf

2015-02-24 Thread aRkadeFR

Please, print your variable request.POST on your
view and see if the csrf_token is missing or not?
Same for your formset variable :)

On 02/24/2015 09:55 AM, joulumaa wrote:
Thanks, but I did exactly that and still 403 csrf error, attached my 
template and related code

thanks for help


{% csrf_token %}

{{ formset }}

 


def school(request):
SchoolFormSet = modelformset_factory(SchoolHistory)
if request.method == 'post':
formset = SchoolFormSetSet(request.POST, request.FILES)
if formset.is_valid():
formset.save()
# do something.
else:
formset = SchoolFormSet()
return render_to_response("testformset.html", {
"formset": formset,
})


tiistai 24. helmikuuta 2015 10.31.13 UTC+2 aRkadeFR kirjoitti:

Hello :)

The template indeed doesn't show the submit button in the
documentation here:

https://docs.djangoproject.com/en/1.7/topics/forms/formsets/#using-a-formset-in-views-and-templates



In order to add the csrf token, you can use the template tag
{% csrf %} inside the form tag.
And add the submit button before closing the form tag too :)

On 02/24/2015 01:09 AM, joulumaa wrote:

Hi,
I just studied and created first modelFormSet, and tried to use
it in view.
I have same code in template as is in django documentation.
modelFormset shows data ok, but submit button is missing,why it
is not in example template in documentation?
ok, I added submit button like I have used with basic forms, it
shows up but cause csrf error,
then I added csrf tag as in form cases before, but still csrf 
error


I am missing some information i guess???, any help for beginner...?

-Vesa
btw, i would like to have that saving button on each row in
formset is it possible?
-- 
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...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com
.
Visit this group at http://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/ee930575-0a61-4c74-ad34-847df414f59c%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout
.




--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54EC5805.7000907%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: modelFormSet and csrf

2015-02-24 Thread joulumaa
Thanks, but I did exactly that and still 403 csrf error, attached my 
template and related code
thanks for help


{% csrf_token %}

{{ formset }}

 


def school(request):
SchoolFormSet = modelformset_factory(SchoolHistory)
if request.method == 'post':
formset = SchoolFormSetSet(request.POST, request.FILES)
if formset.is_valid():
formset.save()
# do something.
else:
formset = SchoolFormSet()
return render_to_response("testformset.html", {
"formset": formset,
})


tiistai 24. helmikuuta 2015 10.31.13 UTC+2 aRkadeFR kirjoitti:
>
>  Hello :)
>
> The template indeed doesn't show the submit button in the
> documentation here:
>
> https://docs.djangoproject.com/en/1.7/topics/forms/formsets/#using-a-formset-in-views-and-templates
>
> In order to add the csrf token, you can use the template tag
> {% csrf %} inside the form tag.
> And add the submit button before closing the form tag too :)
>
> On 02/24/2015 01:09 AM, joulumaa wrote:
>  
> Hi,
> I just studied and created first modelFormSet, and tried to use it in view.
> I have same code in template as is in django documentation.
> modelFormset shows data ok, but submit button is missing,why it is not in 
> example template in documentation?
> ok, I added submit button like I have used with basic forms, it shows up 
> but cause csrf error,
> then I added csrf tag as in form cases before, but still csrf  error
>
> I am missing some information i guess???, any help for beginner...?
>
> -Vesa
> btw, i would like to have that saving button on each row in formset is 
> it possible?
>  -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/ee930575-0a61-4c74-ad34-847df414f59c%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>  

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/471531a9-27d8-43b0-b85a-305a50e59612%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: modelFormSet and csrf

2015-02-24 Thread aRkadeFR

Hello :)

The template indeed doesn't show the submit button in the
documentation here:
https://docs.djangoproject.com/en/1.7/topics/forms/formsets/#using-a-formset-in-views-and-templates

In order to add the csrf token, you can use the template tag
{% csrf %} inside the form tag.
And add the submit button before closing the form tag too :)

On 02/24/2015 01:09 AM, joulumaa wrote:

Hi,
I just studied and created first modelFormSet, and tried to use it in 
view.

I have same code in template as is in django documentation.
modelFormset shows data ok, but submit button is missing,why it is not 
in example template in documentation?
ok, I added submit button like I have used with basic forms, it shows 
up but cause csrf error,

then I added csrf tag as in form cases before, but still csrf error

I am missing some information i guess???, any help for beginner...?

-Vesa
btw, i would like to have that saving button on each row in 
formset is it possible?

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ee930575-0a61-4c74-ad34-847df414f59c%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54EC367F.6090602%40arkade.info.
For more options, visit https://groups.google.com/d/optout.