Karl Sutt | 1 May 2012 01:36
Picon
Gravatar

Re: [help] Server Config: django + uwsgi + nginx

I am not entirely sure what you mean by that. If you mean the nginx equivalent of Apache VirtualHosts then the nginx wiki explains it quite nicely http://wiki.nginx.org/ServerBlockExample. Is that what you meant?


Karl Sutt


On Mon, Apr 30, 2012 at 7:04 PM, easypie <program.py <at> gmail.com> wrote:
does your configuration allow for running multiple sites?


On Sunday, April 29, 2012 12:01:27 PM UTC-7, Karl Sutt wrote:
Here is my uWSGI command and nginx.conf contents:


I've used it for a Flask application, but I've just tested it and it works for a Django project as well. Note that wsgi.py file in the uwsgi command is the Python file that Django generates when you first create a project, there is no need to change it.

Good luck!

Karl Sutt


On Sun, Apr 29, 2012 at 6:49 PM, easypie <program.py <at> gmail.com> wrote:
I have this file that was created for me by one of the users in django's irc channel. I edited to have the right information inserted but I"m not sure what I'm doing wrong to not make it work. I've spent some time trying to understand each line by searching the web. There's still a thing or two that's missing from the puzzle. Maybe it's the server config that has a flaw or the way I went about it. I haven't done a fresh install of uwsgi and nginx yet. However, please take a look to see if there's an error or solution that could work. Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/2rekHP0I6V0J.
To post to this group, send email to django-users <at> googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/sMsRN5iG9NQJ.

To post to this group, send email to django-users <at> googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users <at> googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Christos Jonathan Hayward | 1 May 2012 01:50
Picon
Gravatar

Chicago openings?

Does anyone have a Chicago opening for an end-to-end web developer using Python and Django?


--
Jonathan Hayward, an Orthodox Christian author.

Amazon  Author Bio  Books  Email • Facebook • Google Plus Kindle • LinkedIn • Twitter • Web • What's New?

I invite you to visit my "theology, literature, and other creative works" site. See a random page!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users <at> googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Larry Martell | 1 May 2012 02:38
Picon
Gravatar

Re: executing raw sql

On Mon, Apr 30, 2012 at 6:26 PM, Dennis Lee Bieber
<wlfraed <at> ix.netcom.com> wrote:
> On Mon, 30 Apr 2012 15:29:08 -0600, Larry Martell
> <larry.martell <at> gmail.com> declaimed the following in
> gmane.comp.python.django.user:
>
>>
>> But in django I am doing this:
>>
>> from django.db import connection
>> cursor = connection.cursor()
>> cursor.execute(sql)
>>
>> and it's getting the error, so that would mean that the sql isn't
>> getting executed for some reason. I'll have to investigate that
>> avenue.
>
>        You still haven't show us what "sql" contains... Given your three
> statements I'd expect to get an error message since "sql" itself is
> undefined.

I figured out the problem. I had %s in my sql, and they was getting
treated as a format specifier. When I built the sql I did put in '%%',
but I had to put in 4 '%%%%' for it to work.

--

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

Rajat Jain | 1 May 2012 03:21
Picon
Gravatar

The template tag {% load tz %}

Hi,

I am shifting to Django 1.4 and want to use the timezone support (for which I want to use {% load tz %} in my templates). The problem is that I have aroudn 30-40 templates, and manually adding these tags to each template is a pain. Is there a way by which I can do this loading by default in all the templates?

Thanks,
Rajat

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users <at> googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
CLIFFORD ILKAY | 1 May 2012 03:40

Re: The template tag {% load tz %}

On 04/30/2012 09:21 PM, Rajat Jain wrote:
> Hi,
>
> I am shifting to Django 1.4 and want to use the timezone support (for
> which I want to use {% load tz %} in my templates). The problem is that
> I have aroudn 30-40 templates, and manually adding these tags to each
> template is a pain. Is there a way by which I can do this loading by
> default in all the templates?

Hi Rajat,

You can use sed. See: <http://www.grymoire.com/Unix/Sed.html#uh-39>.
-- 
Regards,

Clifford Ilkay
Dinamis
1419-3230 Yonge St.
Toronto, ON
Canada  M4N 3P6

<http://dinamis.com>
+1 416-410-3326

--

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

Aditya Sriram M | 1 May 2012 03:52
Picon

Django admin site display (None) even when values are non-null/empty


I have been trying a lot but could not make out why it happens,

class FortressUserAdmin(admin.ModelAdmin):    
list_display
(. . . , get_my_schema)    
def get_my_schema(self, obj):
    sql_query
= "select prop_val from customer_property where customer_id = %d and property_value like '%%%%SCHEMA%%%%'" % obj.customer_id.customer_id    
    property_value
= connection.cursor().execute(sql_query).fetch_one()        
   
print sql_query        
   
return 1
   
# return "aditya"
get_my_schema
.short_description = 'Schema Instance'

  • why the column values are always (None)
  • why the print 1 or print 'aditya' won't print anything to the console

Screen shot of the column admin site:

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/liHNhbNpk_QJ.
To post to this group, send email to django-users <at> googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Gchorn | 1 May 2012 07:34
Picon

Dojo Rich Editor Implementation in Admin.py

Hi All,

I'm building a blog, with models "Post" and "Image" (each blog post can have multiple images; they're related by ForeignKey) and I'm trying to implement the Dojo rich editor in my admin site by following the example here:

https://gist.github.com/868595

However, the rich editor is not showing up.  I have a feeling I don't have something set up correctly in my admin.py file; could anyone tell me what it is?  Here are the contents of admin.py:

from blogs.models import Post,Image
from django.contrib import admin
from django.contrib.admin import site, ModelAdmin
import models


class CommonMedia:
  js = (
    'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
    '/home/guillaume/mysite/blogs/static/editor.js',
  )
  css = {
    'all': ('/home/guillaume/mysite/blogs/static/editor.css',),
  }

class PostImageInline(admin.TabularInline):
    model = Image
    extra = 5

class PostAdmin(admin.ModelAdmin):
    inlines = [PostImageInline]

site.register(models.Post,
    list_display = ('text',),
    search_fields = ['text',],
    Media = CommonMedia,
)

admin.site.unregister(Post)

admin.site.register(Post, PostAdmin)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/IPDPAY_Z5skJ.
To post to this group, send email to django-users <at> googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
LJ | 1 May 2012 07:46
Picon

Trouble with query syntax in Django view

I have a Student model that stores information about a student,
including the student's teacher.
The teacher's information is stored in the Employee model that
inherits from the Person Model.
I am having trouble figuring out how to query the teacher, when a
student id is passed as an ajax argument to the view function.
I have no trouble returning the data about the parents and the
student, but my filter for querying the teacher info is incorrect.
Does anyone have any ideas how I can query for the teacher information
based on the models below?

#models.py
class Student(Person):
    grade = models.ForeignKey('schools.Grade')
    school = models.ManyToManyField('schools.School', blank=True,
null=True, related_name="school")
    parents = models.ManyToManyField('parents.Parent', blank=True,
null=True)
    teacher = models.ForeignKey(Employee, blank=True, null=True,
related_name='teacher')

class Employee(Person):
    ''' Employee model inherit Person Model'''
    role=models.ForeignKey(EmployeeType, blank=True, null=True)
    user=models.ForeignKey(User)
    schools =
models.ManyToManyField(School,blank=True,null=True)

# views.py
def get_required_meeting_participants(request, template):
    try:
        id=request.GET['id']
    except:
        id=None

    parents = Parent.objects.filter(student=id)
    student = Student.objects.filter(pk=id)
    teacher = Employee.objects.filter(pk=student.teacher_id)  #this
line is incorrect...help, please?

    data = {
        'parents': parents,
	'student': student,
	'teacher': teacher,
    }

    return
render_to_response(template,data,
                            context_instance=RequestContext(request))

--

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

Alexandr Aibulatov | 1 May 2012 07:56
Picon
Gravatar

Re:: Trouble with query syntax in Django view

You can get teacher and parents objects from student instance. student.teacher and student.teachers.all()

01.05.2012 11:46 пользователь "LJ" <ljayadams <at> gmail.com> написал:
I have a Student model that stores information about a student,
including the student's teacher.
The teacher's information is stored in the Employee model that
inherits from the Person Model.
I am having trouble figuring out how to query the teacher, when a
student id is passed as an ajax argument to the view function.
I have no trouble returning the data about the parents and the
student, but my filter for querying the teacher info is incorrect.
Does anyone have any ideas how I can query for the teacher information
based on the models below?

#models.py
class Student(Person):
   grade = models.ForeignKey('schools.Grade')
   school = models.ManyToManyField('schools.School', blank=True,
null=True, related_name="school")
   parents = models.ManyToManyField('parents.Parent', blank=True,
null=True)
   teacher = models.ForeignKey(Employee, blank=True, null=True,
related_name='teacher')

class Employee(Person):
   ''' Employee model inherit Person Model'''
   role=models.ForeignKey(EmployeeType, blank=True, null=True)
   user=models.ForeignKey(User)
   schools =
models.ManyToManyField(School,blank=True,null=True)

# views.py
def get_required_meeting_participants(request, template):
   try:
       id=request.GET['id']
   except:
       id=None

   parents = Parent.objects.filter(student=id)
   student = Student.objects.filter(pk=id)
   teacher = Employee.objects.filter(pk=student.teacher_id)  #this
line is incorrect...help, please?

   data = {
       'parents': parents,
       'student': student,
       'teacher': teacher,
   }

   return
render_to_response(template,data,
                           context_instance=RequestContext(request))

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

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

Gmane