Do you ever come across comments expressing anger or happiness when developing open-source software?

2020-09-08 Thread Nathan Cassee


To Whom it may concern, 

 

We are an international team of researchers, from the University of Bari, 
Italy, and Eindhoven University of Technology, the Netherlands. The goal of 
our research is to help improve the health and long term stability of 
open-source communities. We would like to learn about your experiences when 
contributing to open-source projects such as this. More specifically, we 
want to understand how you, as open-source contributors, experience the 
emotions that are expressed in online discussions about developing software.

 

If you are interested in talking about your experiences as an open-source 
contributor then please schedule a meeting with us using calendy here (
https://calendly.com/n-w-cassee/interview). We are interested in different 
experiences, therefore, we are looking to talk to people of all age-groups, 
genders, and people with different roles in open-source projects. So even 
whether you are a first time contributor or a senior maintainer don’t 
hesitate to schedule a meeting! If you have any questions you can always 
send us an e-mail at n.w.cas...@tue.nl. 

 

The interview itself will take no longer than one hour, and will be 
scheduled using Microsoft Teams. We will record the interview and the 
recording and transcript of the interview will  be stored securely, and 
only made available to the researchers that are involved in this project. 
Additionally, we plan to use anonymized results of the interview in a 
scientific publication.  

 

Kind regards and thanks in advance,

 

Nicole Novielli,

University of Bari

http://collab.di.uniba.it/nicole/

 

Alexander Serebrenik,

Eindhoven University of Technology

https://www.win.tue.nl/~aserebre/

 

Nathan Cassee, 

Eindhoven University of Technology

https://cassee.dev 

 

 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/78f21c1b-7f10-4371-8f2e-f823fc0b050fn%40googlegroups.com.


ModelSelect2 field doesn't appear

2020-07-17 Thread Nathan Duy Le
Hi all!
I've been losing hair trying to figure out why a ModelSelect2 field works 
on one ModelForm but not the other almost identical one.  Please save me 
from going mad!

In the browser's console, I'm getting the error message:
jQuery.Deferred exception: $(...).select2 is not a function TypeError: 
$(...).select2 is not a function
at HTMLSelectElement. 
(http://localhost:8000/static/autocomplete_light/select2.js:102:17)
at HTMLDocument.dispatch 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:41772)
at HTMLDocument.y.handle 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:39791)
at Object.trigger 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:69551)
at HTMLSelectElement. 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:70146)
at Function.each 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:2573)
at w.fn.init.each 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:1240)
at w.fn.init.trigger 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:70122)
at HTMLSelectElement.initialize 
(http://localhost:8000/static/autocomplete_light/autocomplete.init.js:47:20)
at Function.each 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:2573) 
undefined
w.Deferred.exceptionHook @ jquery.min.js:2
c @ jquery.min.js:2
setTimeout (async)
(anonymous) @ jquery.min.js:2
u @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
u @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
_ @ jquery.min.js:2
jquery.min.js:2 Uncaught TypeError: $(...).select2 is not a function
at HTMLSelectElement. (select2.js:102)
at HTMLDocument.dispatch (jquery.min.js:2)
at HTMLDocument.y.handle (jquery.min.js:2)
at Object.trigger (jquery.min.js:2)
at HTMLSelectElement. (jquery.min.js:2)
at Function.each (jquery.min.js:2)
at w.fn.init.each (jquery.min.js:2)
at w.fn.init.trigger (jquery.min.js:2)
at HTMLSelectElement.initialize (autocomplete.init.js:47)
at Function.each (jquery.min.js:2)



1. I've tried  using the same ModelChoiceField as below on another 
ModelForm and it worked perfectly.
2. if I remove the ModelChoiceField for the referred_from field, the field 
displays ok with a normal dropdown for choices.
3. if I leave the ModelChoiceField for the referred_from field as it is 
below, the field will show up with only one selectable choice ("").


My non-working code:
forms.py
class CustomerEntryForm(ModelForm):
referred_from = 
forms.ModelChoiceField(queryset=ReferredFrom.objects.all(), 
widget=autocomplete.ModelSelect2(url='referred-from-autocomplete', attrs={
'data-placeholder': 'Search...',
}))

class Meta:
model = Customer
widgets = {
'notes': forms.Textarea(attrs={'rows': 2, 'cols': 30}),
}
fields = ['referred_from', 'nickname', 'first_name', 'last_name', 
'home_address', 'birthdate', 'phone', 'email',  'notes', 'ID1', 'ID2', 
'DOC1', 'DOC2']


views.py:
def customer_new(request, representative):
rep_obj = Representative.objects.get(alias=representative)
if request.method == "POST":

form = CustomerEntryForm(request.POST, files=request.FILES)

if form.is_valid():
instance = form.save(commit=False)
instance.entered_by_rep = rep_obj
instance.save()
return redirect('customer_details', pk=instance.id)
else:
form = CustomerEntryForm()
return render(request, 'transactions/customer_new.html', {'form': form})


customer_new.html:
{% extends 'base.html' %}

{% load static %}

{% block content %}


{{ form.media }}


  
  Nouveau Client / New Customer 


  {% csrf_token %}
  
  {{ form.as_table }}
  
  
  
  



  

{% endblock %}



This template works (the view and ModelForm class are pretty much 
identical):

{% extends "base.html" %}

{% load static %}

{% block content %}


{% if form.errors %}
{% for field in form %}
{% for error in field.errors %}

{{ error|escape }}

{% endfor %}
{% endfor %}
{% for error in form.non_field_errors %}

{{ error|escape }}

{% endfor %}
{% endif %}

{{ form.media }}




ATM Balance Transaction


{% csrf_token %}

{{ form.as_table }}






{% endblock %}

Thanks in advance for you help

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7cb4e706-f229-4ada-9239-3dc09e5e0b56o%40googlegroups.com.


Re: [django-channels] I want to use aioredis connection pool ,not create new connection in every AsyncWebsocketConsumer.connect .Where can I put the code.

2020-02-04 Thread Nathan Jones
Hi,

Did you ever work out how to do this?

The only way I could work out how to use a shared pool was to go back to 
the regular sync `redis` library and use sync_to_async, for example

`settings.py`

REDIS_PRO_POOL = redis.ConnectionPool(host='localhost', port=6379, db=3)


`consumer.py`

class TestConsumer(AsyncWebsocketConsumer):

@sync_to_async
def test(self, value):
r = redis.Redis(connection_pool=settings.REDIS_PRO_POOL)
r.set("TEST", value)
print(r.get(value))
r.close()

async def connect(self):
await self.test("hello")   






On Tuesday, May 14, 2019 at 3:57:30 AM UTC+1, CrazyNPC wrote:
>
> Hello,
> Now I create new connection in connect event every time, code like this
> async def connect(self):
> self.redis = await aioredis.create_redis(
> 'redis://localhost',encoding='utf-8')
> async def disconnect(self, close_code):
>  await self.redis.close()
>
> I need something like  self.channel_layer ,using pool connection across 
> every consumer.
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/44aafbcc-dc47-4de3-ae39-70c38e3b3e2c%40googlegroups.com.


Re: Python Django Training

2020-02-03 Thread MEGA NATHAN
  I am also interested to attend the training.






*Regards*
Meganathan G



On Mon, Feb 3, 2020 at 6:03 PM Chuck  wrote:

> i am also interested please add me.
>
> Thanks,
> Chuck
>
> On Sunday, February 2, 2020, 10:27:26 PM PST, sagar ninave <
> sagarnin...@gmail.com> wrote:
>
>
> i am also interested please add me
> whats app : 9657445206
> Email : sagarnin...@gmail.com
>
> On Mon, Feb 3, 2020 at 11:33 AM Sarvesh singh  wrote:
>
> i am very passionate to learn django more.
> thanks to you for your support.
>
>
> On Sat, Feb 1, 2020 at 7:12 PM Srikanth K  wrote:
>
> Hi,
>
> I am from Hyderabad. I am Python Developer by Profession. I am eager take
> up any Python , Django Training (online Preferrable or Weekends). Members
> who require can contact me or share me  there idea.
>
> Regards,
> Srikanth.K
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACPyz-gXb7wo9E0Uhs_pnxF9X52uA10__Fq1xt4trjXUaN3ehQ%40mail.gmail.com
> 
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAK3CZUZ5vwO3ejKf5FpU_i5cQxH%3Dq65TgHKBY44Fu7GDZT2TLw%40mail.gmail.com
> 
> .
>
>
>
> --
>
> 
> sagar ninave
> about.me/sagarninave
> 
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAA6pdZ93Ev%3DqmS9dsnS4jDCeivVni88RnYBo0gRkH3bbkcf-_g%40mail.gmail.com
> 
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/885840711.599527.1580712315881%40mail.yahoo.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEvDBLd%3D9UBxh4rLSxdo-frfh8AQq1jWftdku2w4TgC0RhFXCA%40mail.gmail.com.


post list view not found NoReverseMatch

2020-01-29 Thread MEGA NATHAN
Hi All.
And this my view page if any bug please tell me.
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from blog.models import Post, Comment
from django.utils import timezone
from blog.forms import PostForm, CommentForm

from django.views.generic import (TemplateView,ListView,
  DetailView,CreateView,
  UpdateView,DeleteView)

from django.urls import reverse_lazy
from django.contrib.auth.mixins import LoginRequiredMixin

class AboutView(TemplateView):
template_name = 'about.html'

class PostListView(ListView):
model = Post

def get_queryset(self):
return
 Post.objects.filter(published_date__lte=timezone.now()).order_by(
'-published_date')

class PostDetailView(DetailView):
model = Post


class CreatePostView(LoginRequiredMixin,CreateView):
login_url = '/login/'
redirect_field_name = 'blog/post_detail.html'

form_class = PostForm

model = Post


class PostUpdateView(LoginRequiredMixin,UpdateView):
login_url = '/login/'
redirect_field_name = 'blog/post_detail.html'

form_class = PostForm

model = Post


class DraftListView(LoginRequiredMixin,ListView):
login_url = '/login/'
redirect_field_name = 'blog/post_draft_list.html'

model = Post

def get_queryset(self):
return Post.objects.filter(published_date__isnull=True).order_by(
'created_date')


class PostDeleteView(LoginRequiredMixin,DeleteView):
model = Post
success_url = reverse_lazy('post_list')

###
## Functions that require a pk match ##
###

@login_required
def post_publish(request, pk):
post = get_object_or_404(Post, pk=pk)
post.publish()
return redirect('post_detail', pk=pk)

@login_required
def add_comment_to_post(request, pk):
post = get_object_or_404(Post, pk=pk)
if request.method == "POST":
form = CommentForm(request.POST)
if form.is_valid():
comment = form.save(commit=False)
comment.post = post
comment.save()
return redirect('post_detail', pk=post.pk)
else:
form = CommentForm()
return render(request, 'blog/comment_form.html', {'form': form})


@login_required
def comment_approve(request, pk):
comment = get_object_or_404(Comment, pk=pk)
comment.approve()
return redirect('post_detail', pk=comment.post.pk)


@login_required
def comment_remove(request, pk):
comment = get_object_or_404(Comment, pk=pk)
post_pk = comment.post.pk
comment.delete()
return redirect('post_detail', pk=post_pk)

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f134f405-7f55-4d77-8568-05a9266f1d24%40googlegroups.com.


FieldError at / Django models how to reslove this issue....

2019-12-19 Thread MEGA NATHAN
Hi all.

Cannot resolve keyword 'published_date_lte' into field. Choices are: author, 
author_id, comments, create_date, id, published_date, text, title

  

this are models:
from django.db import models
from django.utils import timezone
from django.urls import reverse

# Create your models here.

class Post(models.Model):
author = models.ForeignKey('auth.User', on_delete=models.CASCADE,)
title = models.CharField(max_length=200)
text = models.TextField()
create_date = models.DateTimeField(default=timezone.now())
published_date = models.DateTimeField(blank=True, null=True) 

def publish(self):
self.published_date = timezone.now()
self.save()

#def approve_comments(self):
#return self.comments.filter(approved_comments=True)

def approved_comments(self):
return self.comments.filter(approved_comment=True)

#def get_absolute_url(self):
#return reverse("post_detail", kwargs={"pk": self.pk})

def __str__self():
return self.title

class Comment(models.Model):
post = models.ForeignKey('blog.post',related_name='comments'
, on_delete=models.CASCADE,)
title = models.CharField(max_length=200)
text = models.TextField()
create_date = models.DateTimeField(default=timezone.now())
published_date = models.DateTimeField(blank=True, null=True) 
approved_comment = models.BooleanField(default=False)

def approve(self):
self.approved_comment = True
self.save()

def get_absolute_url(self):
return reverse('post_list')
 
def __str__(self):
return self.text

And views:

from django.shortcuts import render, get_object_or_404, redirect
from django.utils import timezone
#from django.utils.timezone.now`
from blog.models import Post, Comment
from .forms import PostForm,CommentForm
from django.urls import reverse_lazy
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin 
from django.views.generic import
 (TemplateView, ListView, DetailView, CreateView,
UpdateView, DeleteView)

# Create your views here.

class Aboutview(TemplateView):
template_name = 'about.html'

class PostListView(ListView):
model = Post

def get_queryset(self):
return
 Post.objects.filter(published_date_lte=timezone.now()).order_by(
'-published_date')

class PostDetailView(DetailView):
model = Post

class CreatePostView(LoginRequiredMixin,CreateView):
Login_url = '/Login/'
redirect_field_name = 'blog/post_detail.html'
from_class = PostForm
model = Post

class PostUpdateView(LoginRequiredMixin, UpdateView):
Login_url = '/Login/'
redirect_field_name = 'blog/post_detail.html'
from_class = PostForm
model = Post
   
#class PostDeleteView(loginrequiredMixin, DeleteView):
class PostDeleteView(LoginRequiredMixin,DeleteView):
model = Post
success_url = reverse_lazy('post_list')

class DraftListView(LoginRequiredMixin, ListView):
login_url = '/Login/'
redirect_field_name = 'blog/post_list.html'
model = Post

def get__queryset(self):
return Post.objects.filter(published_date_isnull=True).order_by(
'created_date')


#
##
def add_comment_to_post(request, pk):
post = get_object_or_404(Post, pk=pk)
if request.method == "POST":
form = CommentForm(request.POST)
if form.is_valid():
comment = form.save(commit=False)
comment.post = post
comment.save()
return redirect('post_detail', pk=post.pk)
else:
form = CommentForm()
return render(request, 'blog/comment_form.html', {'form': form})

@login_required
def post_publish(request, pk):
post = get_object_or_404(Post, pk=pk)
post.publish
return redirect('blog/post_detail.html', pk=pk)

#@login_required
def comment_approve(request,pk):
comment = get_object_or_404(comment,pk=pk)
comment.approve()
return redirect('post_detail',pk=comment.post.pk)

#@login_required
def comment_remove(request,pk):
#comment = get_object_or_404(comment, pk=pk)
#comment.remove()
#return redirect('post_detail',pk=comment.post.pk)
comment = get_object_or_404(comment, pk=pk)
post_pk = comment.post.pk
comment_delete()
return redirect('post_detail',pk=comment.post.pk)

*blog urls:*

#from django.conf.urls import path
from django.urls import include, path

from blog import views

urlpatterns = [
path('',views.PostListView.as_view(), name='Post_list'),
path('about', views.Aboutview.as_view, name='about'),
path('Post/(?P\d+)', views.PostDetailView.as_view(), name=
'post_detail'),
path('Post/new/', views.CreatePostView.as_view(), name='post_new'),
path('Post/(?P\d+)/edit/', views.PostUpdateView.as_view(), name=
'post_edit'),
path('Post/(?P\d+)/remove/', views.PostDeleteView.as_view(), name=
'post_

Re: simple Rest_framework cannot import name in api view

2019-11-12 Thread MEGA NATHAN
yeah bro





*Regards*
Meganathan G



On Wed, Nov 13, 2019 at 10:15 AM Suraj Thapa FC 
wrote:

> It should be like.. APIView  not like APIview
>
> On Wed, 13 Nov 2019, 9:33 am MEGA NATHAN, 
> wrote:
>
>> patterns = getattr(self.urlconf_module, "urlpatterns",
>> self.urlconf_module)
>>   File
>> "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py",
>> line 80, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File
>> "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py",
>> line 577, in urlconf_module
>> return import_module(self.urlconf_name)
>>   File
>> "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py",
>> line 127, in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 1006, in _gcd_import
>>   File "", line 983, in _find_and_load
>>   File "", line 967, in
>> _find_and_load_unlocked
>>   File "", line 677, in _load_unlocked
>>   File "", line 728, in exec_module
>>   File "", line 219, in
>> _call_with_frames_removed
>>   File "C:\Users\Meghanathan\Desktop\java
>> script\drf_api\drf_api\urls.py", line 4, in 
>> from core.views import TestView
>>   File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py",
>> line 8, in 
>> from core.serializers import PostSerializer
>> ImportError: cannot import name 'PostSerializer' from 'core.serializers'
>> (C:\Users\Meghanathan\Desktop\java script\drf_api\core\serializers.py)
>>
>>
>>
>> On Wednesday, November 13, 2019 at 7:48:00 AM UTC+5:30, MEGA NATHAN wrote:
>>>
>>> Hi.
>>>
>>> i was creating simple REST_framework this api view ,connot import name
>>> in error. how to reslove this error
>>>
>>>
>>>
>>> __.py", line 127, in import_module
>>> return _bootstrap._gcd_import(name[level:], package, level)
>>>   File "", line 1006, in _gcd_import
>>>   File "", line 983, in _find_and_load
>>>   File "", line 967, in
>>> _find_and_load_unlocked
>>>   File "", line 677, in _load_unlocked
>>>   File "", line 728, in exec_module
>>>   File "", line 219, in
>>> _call_with_frames_removed
>>>   File "C:\Users\Meghanathan\Desktop\java
>>> script\drf_api\drf_api\urls.py", line 4, in 
>>> from core.views import test_view
>>>   File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py",
>>> line 6, in 
>>> from rest_framework.views import APIview
>>> ImportError: cannot import name 'APIview' from 'rest_framework.views'
>>> (C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rest_framework\views.py)
>>>
>>>
>>> Regards
>>> Meganathan G
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/6f7e0d7c-262b-4bb8-b3b4-fe44f0e7d991%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/6f7e0d7c-262b-4bb8-b3b4-fe44f0e7d991%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcGjq%3Du3E%2BjdJZg3m8aMymHfHxV3O2KqKya_u_Vy3p96Bw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPjsHcGjq%3Du3E%2BjdJZg3m8aMymHfHxV3O2KqKya_u_Vy3p96Bw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEvDBLcEwBOQhppvuPn8rRHoLs7qYaxbumviETDH5nXmL46vag%40mail.gmail.com.


Re: simple Rest_framework cannot import name in api view

2019-11-12 Thread MEGA NATHAN
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File 
"C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py",
 
line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py",
 
line 577, in urlconf_module
return import_module(self.urlconf_name)
  File 
"C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py",
 
line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1006, in _gcd_import
  File "", line 983, in _find_and_load
  File "", line 967, in _find_and_load_unlocked
  File "", line 677, in _load_unlocked
  File "", line 728, in exec_module
  File "", line 219, in 
_call_with_frames_removed
  File "C:\Users\Meghanathan\Desktop\java script\drf_api\drf_api\urls.py", 
line 4, in 
from core.views import TestView
  File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py", 
line 8, in 
from core.serializers import PostSerializer
ImportError: cannot import name 'PostSerializer' from 'core.serializers' 
(C:\Users\Meghanathan\Desktop\java script\drf_api\core\serializers.py)



On Wednesday, November 13, 2019 at 7:48:00 AM UTC+5:30, MEGA NATHAN wrote:
>
> Hi.
>
> i was creating simple REST_framework this api view ,connot import name in 
> error. how to reslove this error 
>
>
>
> __.py", line 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1006, in _gcd_import
>   File "", line 983, in _find_and_load
>   File "", line 967, in 
> _find_and_load_unlocked
>   File "", line 677, in _load_unlocked
>   File "", line 728, in exec_module
>   File "", line 219, in 
> _call_with_frames_removed
>   File "C:\Users\Meghanathan\Desktop\java script\drf_api\drf_api\urls.py", 
> line 4, in 
> from core.views import test_view
>   File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py", 
> line 6, in 
> from rest_framework.views import APIview
> ImportError: cannot import name 'APIview' from 'rest_framework.views' 
> (C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rest_framework\views.py)
>
>
> Regards
> Meganathan G
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6f7e0d7c-262b-4bb8-b3b4-fe44f0e7d991%40googlegroups.com.


database could't connect in python to atom

2019-10-22 Thread MEGA NATHAN
Hi.

AttributeError: module 'mysql.connector' has no attribute 'connect'





regards
Meganathan,

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20f71ae7-75ed-4126-b786-6c675041d9f9%40googlegroups.com.


Re: cannot import path in urls

2019-10-02 Thread MEGA NATHAN
Hi.
In which  file i rewrite app/urls are main file url i write...





*Regards*
Meganathan G



On Thu, Oct 3, 2019 at 10:21 AM Suraj Thapa FC 
wrote:

> In urls.py
> Write
> from django.urls import path
>
> On Thu, 3 Oct, 2019, 10:02 AM MEGA NATHAN, 
> wrote:
>
>> Hi.
>>
>>
>> i'm meganathan beginer for django 
>>
>> urls cannot import for path . how to reslove 
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a0c82af4-da14-49e4-a0af-eff26f47afbd%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/a0c82af4-da14-49e4-a0af-eff26f47afbd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcEv9-av30MrCetr0FxAHHEpjHM_0jiava_PP6XdKQWLwg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPjsHcEv9-av30MrCetr0FxAHHEpjHM_0jiava_PP6XdKQWLwg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEvDBLdYvK%2BQBYCfX_g3mchvJ91NT5xEXA8ZDjFqjru-SLPU3A%40mail.gmail.com.


Re: ModuleNotFoundError: No module named :

2019-09-25 Thread MEGA NATHAN
hi.

populate script error in line 12




*Regards*
Meganathan G



On Wed, Sep 25, 2019 at 9:57 AM Abu Yusuf 
wrote:

> share your full project here.
>
> On Tue, Sep 24, 2019 at 10:43 PM MEGA NATHAN 
> wrote:
>
>>
>>
>> Hi.
>>  again i change and run but same problem coming 
>>
>>
>>
>> *Regards*
>> Meganathan G
>>
>>
>>
>> On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf 
>> wrote:
>>
>>> Error in admin.py. So same here in admin.py.
>>>
>>> Before starting a django project, try to understand the architecture of
>>> it and the working flow of it.
>>> Otherwise, you can't go long away.
>>> Best Wishes,
>>>
>>> On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf 
>>> wrote:
>>>
>>>> In your views.py:
>>>> from .models import users
>>>>
>>>> That's it.
>>>>
>>>> On Tue, Sep 24, 2019 at 10:13 AM Deep Sukhwani 
>>>> wrote:
>>>>
>>>>> Are you supposed to be using a virtualenv and you don't have that
>>>>> activated?
>>>>>
>>>>> Can you run *pip freeze | grep -i django* and share the output?
>>>>>
>>>>> --
>>>>> Regards
>>>>> Deep L Sukhwani
>>>>>
>>>>>
>>>>> On Tue, 24 Sep 2019 at 09:40, MEGA NATHAN 
>>>>> wrote:
>>>>>
>>>>>> Hi.
>>>>>>
>>>>>>
>>>>>> i 'm meganathan from india i was doing django trining ,
>>>>>>
>>>>>> And i have one dout .mo module name found models
>>>>>>
>>>>>> *ModuleNotFoundError: No module named 'django.models'*
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> *Regards*
>>>>>> *Meganathan,*
>>>>>>
>>>>>> --
>>>>>> 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 view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/django-users/f85f29b7-e3d9-4dfa-945f-70f1fb8e90f1%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/django-users/f85f29b7-e3d9-4dfa-945f-70f1fb8e90f1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> 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 view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAEMqiPe7rf4syuVUTEZVO%2BOMh7K-cvGX_yLsL0vhchNbTTfATw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAEMqiPe7rf4syuVUTEZVO%2BOMh7K-cvGX_yLsL0vhchNbTTfATw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CACNsr2-bU6cCHuthEizB4ZB45UcTns3c-wERXqmbo36upa7Ksw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CACNsr2-bU6cCHuthEizB4ZB45UcTns3c-wERXqmbo36upa7Ksw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEvDBLeWLN4%3DpQSBA8AkoLQF5ByWXvcScZJznL__6kQR20UAfg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAEvDBLeWLN4%3DpQSBA8AkoLQF5ByWXvcScZJznL__6kQR20UAfg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACNsr2-GJBUAZs7hhe6JhTnXQOO7zdrivNygQp%3DR78%2Bdb9UP0w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACNsr2-GJBUAZs7hhe6JhTnXQOO7zdrivNygQp%3DR78%2Bdb9UP0w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEvDBLcCVNnQHS9Q8AMF%2B17Mn%3DYZLdbwgT9sQaXi%2BfHGK6UCtQ%40mail.gmail.com.


Re: ModuleNotFoundError: No module named :

2019-09-24 Thread MEGA NATHAN
Hi.
 again i change and run but same problem coming 



*Regards*
Meganathan G



On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf 
wrote:

> Error in admin.py. So same here in admin.py.
>
> Before starting a django project, try to understand the architecture of it
> and the working flow of it.
> Otherwise, you can't go long away.
> Best Wishes,
>
> On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf 
> wrote:
>
>> In your views.py:
>> from .models import users
>>
>> That's it.
>>
>> On Tue, Sep 24, 2019 at 10:13 AM Deep Sukhwani 
>> wrote:
>>
>>> Are you supposed to be using a virtualenv and you don't have that
>>> activated?
>>>
>>> Can you run *pip freeze | grep -i django* and share the output?
>>>
>>> --
>>> Regards
>>> Deep L Sukhwani
>>>
>>>
>>> On Tue, 24 Sep 2019 at 09:40, MEGA NATHAN 
>>> wrote:
>>>
>>>> Hi.
>>>>
>>>>
>>>> i 'm meganathan from india i was doing django trining ,
>>>>
>>>> And i have one dout .mo module name found models
>>>>
>>>> *ModuleNotFoundError: No module named 'django.models'*
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *Regards*
>>>> *Meganathan,*
>>>>
>>>> --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/f85f29b7-e3d9-4dfa-945f-70f1fb8e90f1%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/f85f29b7-e3d9-4dfa-945f-70f1fb8e90f1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAEMqiPe7rf4syuVUTEZVO%2BOMh7K-cvGX_yLsL0vhchNbTTfATw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAEMqiPe7rf4syuVUTEZVO%2BOMh7K-cvGX_yLsL0vhchNbTTfATw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACNsr2-bU6cCHuthEizB4ZB45UcTns3c-wERXqmbo36upa7Ksw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACNsr2-bU6cCHuthEizB4ZB45UcTns3c-wERXqmbo36upa7Ksw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEvDBLeWLN4%3DpQSBA8AkoLQF5ByWXvcScZJznL__6kQR20UAfg%40mail.gmail.com.


Re: Django cms and templates

2019-09-19 Thread MEGA NATHAN
Hi.

you check app name  127.0.0.8/app name




*Regards*
Meganathan G



On Thu, Sep 19, 2019 at 4:30 AM Perceval Maturure 
wrote:

> Dear all
>
> I have a django project done with Django 2.1 and successfully made an
> apphook to the cms page bt the problem is that the template file does not
> display model data unless if I remove the syntax { %extends base.html %} at
> the top of the template html file
> What could be causing this?
> Please help
>
> Sent from my iPhone
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4CE4415B-DDC4-4074-8F8C-630D98641EE5%40gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEvDBLc%2B-yyHC4cxsGH8wrk_v-6q-cpgWwK7x0q-6ajkfO2cHQ%40mail.gmail.com.


Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread Nathan Bluvol
Hi Andrew,
Thank you for your quick reply. I use AsyncConsumer in the background 
worker because it seems to route properly (i.e. without error). If I create 
a new class, then I run into scope issues or simply a TypeError where the 
'backgroundConsumer object is not callable'. *The reason for all of this is 
that when I originally had my external websocket code directly inside 
consumer.py, it ended up blocking any incoming/outgoing communication 
between the AsyncWebsocketConsumer and the browser - probably because, as 
you said 'your listen() method is blocking...[because it]listens on it 
for messages forever'.* Since I am new to asyncio development, I figured 
the best way was to run the external websocket in a background worker, 
asynchronously, and then maintain my websocket consumer for dynamic browser 
updates - which "works" but apparently not for so long. Is there a better 
way to architect this that you suggest? By the way, you've done a terrific 
job with channels...

Here is my routing, so that it's clear what I am doing:

*routing.py*

from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter, 
ChannelNameRouter
import dashboard.routing
from dashboard.backgroundUpdater import backgroundConsumer

application = ProtocolTypeRouter({
# (http->django views is added by default)
'websocket': AuthMiddlewareStack(
URLRouter(
dashboard.routing.websocket_urlpatterns
)
),
'channel': ChannelNameRouter({
"toggle": backgroundConsumer,
}),
})

On Sunday, June 17, 2018 at 2:40:12 PM UTC-4, Andrew Godwin wrote:
>
> I'm not quite sure why you seem to be using an AsyncConsumer outside of 
> the context of the Channels routing framework?
>
> Anyway, it sounds like from what you're describing that your listen() 
> method is blocking, which makes sense, as it connects to an external 
> websocket and listens on it for messages forever. Not sure why the crashing 
> Channels websocket takes down the client one, but maybe they are both made 
> to crash by some third, external, force?
>
> Andrew
>
> On Sun, Jun 17, 2018 at 11:33 AM Nathan Bluvol  > wrote:
>
>> I am using Django 2.0.5, Python 3.6.2, Django Channels 2.1.1, aiohttp 
>> 3.1.3.
>>
>> Background:
>> I am connecting to an external websocket, asynchronously, using aiohttp 
>> within a background channels worker. Once triggered, the socket connection 
>> stays alive, listening/streaming, and sends incoming messages to a consumer 
>> through a group_send. The consumer receives it at the appropriate handler, 
>> however, after some time, it appears that the channels websocket dies and 
>> the handler can no longer be found - I get 'No handler for message 
>> type' even though it has been working successfully until that point. 
>> Second issue is that 'await t1' seems to block in the background. I route 
>> the 'toggle' to backgroundUpdater.py.
>>
>> *consumers.py*:
>>
>> from channels.generic.websocket import AsyncWebsocketConsumer
>> import json
>>
>>
>> class MyConsumer(AsyncWebsocketConsumer):
>>
>> async def connect(self):
>> await self.channel_layer.group_add('myGroup', self.channel_name)
>> await self.accept()
>>
>> async def disconnect(self, closeCode):
>> await self.channel_layer.group_discard('myGroup', 
>> self.channel_name)
>>
>> async def receive(self, text_data):
>> eventData = json.loads(text_data)
>> print(eventData)
>> if eventData['myToggle'] == 'on':
>> await self.channel_layer.send('toggle',{"type": 
>> "openConnection"})
>> elif eventData['myToggle'] == 'off':
>> await self.channel_layer.send('toggle',{"type": 
>> "closeConnection"})
>>
>> async def backgroundWorkerUpdate(self, data):
>> await self.send(text_data=json.dumps(data['updateTime']))
>>
>> *backgroundUpdater.py*:
>>
>> from channels.consumer import AsyncConsumer
>> from channels.layers import get_channel_layer
>> import asyncio
>> import aiohttp
>> import json
>> from dashboard.models import Info
>> import datetime
>>
>>
>> class backgroundConsumer(AsyncConsumer):
>> turnOnListener = True
>> channelLayer = get_channel_layer()
>> loadComplete = False
>>
>> async def listen(self):
>> infoList = Info.objec

Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-17 Thread Nathan Bluvol
I am using Django 2.0.5, Python 3.6.2, Django Channels 2.1.1, aiohttp 3.1.3.

Background:
I am connecting to an external websocket, asynchronously, using aiohttp 
within a background channels worker. Once triggered, the socket connection 
stays alive, listening/streaming, and sends incoming messages to a consumer 
through a group_send. The consumer receives it at the appropriate handler, 
however, after some time, it appears that the channels websocket dies and 
the handler can no longer be found - I get 'No handler for message 
type' even though it has been working successfully until that point. 
Second issue is that 'await t1' seems to block in the background. I route 
the 'toggle' to backgroundUpdater.py.

*consumers.py*:

from channels.generic.websocket import AsyncWebsocketConsumer
import json


class MyConsumer(AsyncWebsocketConsumer):

async def connect(self):
await self.channel_layer.group_add('myGroup', self.channel_name)
await self.accept()

async def disconnect(self, closeCode):
await self.channel_layer.group_discard('myGroup', self.channel_name)

async def receive(self, text_data):
eventData = json.loads(text_data)
print(eventData)
if eventData['myToggle'] == 'on':
await self.channel_layer.send('toggle',{"type": 
"openConnection"})
elif eventData['myToggle'] == 'off':
await self.channel_layer.send('toggle',{"type": 
"closeConnection"})

async def backgroundWorkerUpdate(self, data):
await self.send(text_data=json.dumps(data['updateTime']))

*backgroundUpdater.py*:

from channels.consumer import AsyncConsumer
from channels.layers import get_channel_layer
import asyncio
import aiohttp
import json
from dashboard.models import Info
import datetime


class backgroundConsumer(AsyncConsumer):
turnOnListener = True
channelLayer = get_channel_layer()
loadComplete = False

async def listen(self):
infoList = Info.objects.filter(active=True)
subInfoList = []
for i in infoList:
subInfoList.append('info'+str(t))\
self.loadComplete = False
async with aiohttp.ClientSession() as session:
async with 
session.ws_connect('...streamingsiteURL.../socket.io/?EIO=3&transport=websocket',
 
ssl=False) as ws:
await ws.send_str(str(subInfoList))
async for msg in ws:
if msg.type == aiohttp.WSMsgType.TEXT:
if msg.data.startswith('2'):
await ws.send_str('3')
else:
await self.parseListenData(msg)

async def parseListenData(self, msgContent):
# handles data in here, including a call to datetime

updateMsg = {'type': 'backgroundWorkerUpdate',
 'updateTime': str(updateTime),
 }
print('built update msg and now sending to group')
await self.channelLayer.group_send('myGroup', updateMsg)

async def openConnection(self, event):
if(self.turnOnListener):
await self.channelLayer.group_add(
'myGroup',
self.channel_name,
)
self.turnOnListener = False
loop = asyncio.get_event_loop()
t1 = loop.create_task(self.listen())
await t1
print('awaiting t1') # THIS NEVER PRINTS UNTIL THE WEBSOCKET IN 
consumers.py CRASHES
else:
print('already turned on listener')

async def closeConnection(self, event):
print('in close connection') # CANNOT SEEM TO TRIGGER THIS ONCE 
await t1 is called above...
if(not self.turnOnListener):
print('turn it off')

*Questions*:
1. Why is does this work for some time until the websocket in consumers.py 
crashes? I am assuming it has crashed because of the missing handler (i.e. 
'No handler...' error).
2. Why is the 'await t1' call blocking? When I try to send 'await 
self.channel_layer.send('toggleMarket',{"type": "closeConnection"})', it 
sends, but nothing seems to be received?

I am have been trying to get this to run in different ways, however, I 
cannot seem to resolve these two issues. Any help/suggestions would be 
greatly appreciated.

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/67993058-4e84-4c11-8acd-fd29249a97d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django channels and aiohttp - channels websocket crash & blocking background worker

2018-06-17 Thread Nathan Bluvol
I am using Django 2.0.5, channels 2.1.1, aiohttp 3.1.3

two issues: (1) everything works for a while and then the channels 
websocket dies. Error is 'No handler for message type...'.  (2) the 
background `await t1` call appears to be blocking and it appears that any 
attempt to trigger closeConnection does not work. Would appreciate 
help/suggestions with these issues! Code below:

*consumer.py*:
rom channels.generic.websocket import AsyncWebsocketConsumer
import json


class myConsumer(AsyncWebsocketConsumer):

async def connect(self):
await self.channel_layer.group_add('myGroup', self.channel_name)
await self.accept()

async def disconnect(self, closeCode):
await self.channel_layer.group_discard('myGroup', self.channel_name)

async def receive(self, text_data):
eventData = json.loads(text_data)
if eventData['monitorToggle'] == 'on':
print('on to background worker.')
await self.channel_layer.send('toggle',{"type": 
"openConnection"})
elif eventData['monitorToggle'] == 'off':
print('off to background worker.')
await self.channel_layer.send('toggle',{"type": 
"closeConnection"})

async def myConsumerUpdate(self, data):
await self.send(text_data=json.dumps(data['updateTime'))

*backgroundConsumer.py*
from channels.consumer import AsyncConsumer
from channels.layers import get_channel_layer
import asyncio
import aiohttp
import json
from mystuff.models import Info
import datetime


class myConsumer(AsyncConsumer):
turnOnListener = True
channelLayer = get_channel_layer()

async def listen(self):
infoList = Info.objects.filter(active=True)
subInfoList = []
for i in infoList:
subInfoList.append(sometText'+str(i))
async with aiohttp.ClientSession() as session:
async with 
session.ws_connect('...streamerURL/socket.io/?EIO=3&transport=websocket', 
ssl=False) as ws:
await ws.send_str(str(subInfoList))
async for msg in ws:
if msg.type == aiohttp.WSMsgType.TEXT:
if msg.data.startswith('2'):
await ws.send_str('3')
else:
await self.parseListenData(msg)

async def parseListenData(self, msg):
# some code in here, including call to datetime to parse the msg
updateMsg = {'type': 'myConsumerUpdate',
 'updateTime': str(updateTime),
 }
print('built update msg and now sending to group')
await self.channelLayer.group_send('marketsGroup', updateMsg)

async def openConnection(self, event):
if(self.turnOnListener):
print('adding group')
await self.channelLayer.group_add(
'myGroup',
self.channel_name,
)
print('turned on listener')
self.turnOnListener = False
loop = asyncio.get_event_loop()
t1 = loop.create_task(self.listen())
print('created t1')
await t1
print('awaiting t1') # Does not print until *consumer.py* 
crashes
else:
print('already turned on listener')

async def closeConnection(self, event):
print('in close connection') #Never gets here for some reason due 
to `await t1` blocking...
if(not self.turnOnListener):
print('turn it off')

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba76ddb6-eaad-4caf-8547-1473e15a6d9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django - Angular 4 Serializer for inserting Parent and child Models using single JSON post

2018-04-09 Thread Nathan Sivathanu


My requirement - I have two models TravelReq and TravelReqDetails as below

class TravelReq(models.Model): 
empid= models.CharField(max_length=7) 
startdate= models.DateField()
enddate= models.DateField()
remarks= models.CharField(max_length=30)
missionname= models.CharField(max_length=30)
def __str__(self):
return str(self.id)
class TravelReqDetails(models.Model):
 travelReqID = models.ForeignKey(TravelReq ,related_name  = 'req_details' , 
on_delete=models.CASCADE );
 travelDate= models.DateField()
 lfrom = models.CharField(max_length=30)
 to= models.CharField(max_length=30)
 remarks = models.CharField(max_length=30)
def __str__(self):
return str(self.id)

My serailizer

from  .models import TravelReq ,TravelReqDetailsfrom rest_framework import 
serializers
class TravelReqSerializer(serializers.ModelSerializer):
class Meta:
model = TravelReq
fields = ('empid' , 'startdate' ,   'enddate' , 'remarks' , 
'missionname' ,'req_details')code here

My view

from .models import TravelReq from rest_framework import viewsetsfrom 
.serializers import TravelReqSerializer 

class TravelReqViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = TravelReq.objects.all() 
serializer_class = TravelReqSerializer

*From Angular I will be receiving below JSON as POST / PUT request . What 
is the best way to insert the master(TravelReq) and child records 
(TravelReqDetails) from a single serializer. please advice. If this is not 
the best approach ,please suggest a better / standard approach*

[
{
"empid": "32432",
"startdate": "2017-11-16",
"enddate": "2018-03-17",
"remarks": "asd",
"missionname": "asd",
"req_details": [
{
"id": 1,
"travelDate": "2017-07-18",
"lfrom": "indiaemarks",
"to": "pakistan",
"remarks": "r",
"travelReqID": <> 
},
{
"id": 2,
"travelDate": "2018-04-02",
"lfrom": "pakistan",
"to": "india",
"remarks": "rerutn remarks",
"travelReqID":  <>
}
]
},

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/816ab639-a82d-451a-9868-58ef057205b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: TemplatedDoesNotExist

2017-05-16 Thread Nathan Lea
Hi,

thanks a lot for answering.

- Yes I have the TemplateDoesNotExist when using the runserver command

-My Django version is  1.8.8

- This is the link Im trying to running 
: http://127.0.0.1:8000/p/8kkqcfqk/my_public_goods/Contribute/1/


On Tuesday, May 16, 2017 at 9:14:37 AM UTC-4, Andréas Kühne wrote:
>
> Hi,
>
> Are you getting a TemplateDoesNotExist error when using the runserver 
> command?
>
> That PROBABLY doesn't have anything to do with your PyCharm setup - but 
> rather with how you have included the templates in your settings.
>
> But to be able to help you, we need more information:
> 1. Which version of Django?
> 2. The stacktrace of the error (you can copy the output on the page you 
> are trying to view). 
> 3. You view code.
> 4. Your settings file.
>
> Regards,
>
> Andréas
>
> 2017-05-16 2:09 GMT+02:00 Nathan Lea >:
>
>> hi guys,
>>
>> Im a new otree user  and Im trying to practice myself with "public good". 
>> Im currently facing a troubleshoot when it's time to launch the  game. 
>>
>> In fact when i click on a link  provided  after starting a new session, 
>> it shows me a message telling me  that my  templates aren't quietly  done. 
>>
>> According to me, it's because I didn't enable the django support. However 
>> when i navigate to Languages & Frameworks -> Django  , Pycharm doesn't 
>> allow me to enable Django support. it's only written " Nothing to show"... 
>>
>> I kind of desperate,  someone can help me please.
>>
>> Nat
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/abbd840c-47ed-41fe-9bcd-da806a9bbfd4%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/abbd840c-47ed-41fe-9bcd-da806a9bbfd4%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4ee459c1-9e63-45c4-8eb2-f1f243323823%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


TemplatedDoesNotExist

2017-05-16 Thread Nathan Lea
hi guys,

Im a new otree user  and Im trying to practice myself with "public good". 
Im currently facing a troubleshoot when it's time to launch the  game. 

In fact when i click on a link  provided  after starting a new session, it 
shows me a message telling me  that my  templates aren't quietly  done. 

According to me, it's because I didn't enable the django support. However 
when i navigate to Languages & Frameworks -> Django  , Pycharm doesn't 
allow me to enable Django support. it's only written " Nothing to show"... 

I kind of desperate,  someone can help me please.

Nat

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/abbd840c-47ed-41fe-9bcd-da806a9bbfd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Headless testing

2016-10-12 Thread Nathan
Hi all,

Wondering if anyone has an suggestions for headless django testing - any 
configuration tips or links would be helpful.

My site is django 1.8 and we make extensive use of jquery on the frontend. 
Using phantomjs driver with liveserver test hasn't worked out well. 


-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/822c423b-c8a0-469a-b5dc-2b6ec1977136%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to track number of visitors on django site

2015-03-10 Thread Nathan Clayton
On 3/10/2015 2:16 PM, Andreas Kuhne wrote:
> Hi Vijay,
> 
> Thanks for the suggestion, and we are of course using GA (I should have
> mentioned that). The problem is our CEO doesn't like the way GA compiles
> the information and he also feels that it's too slow, he can't get the
> views that he would like. 
> 
> So we would like to add this information ourselves somehow.
> 
> Regards,
> 
> Andréas
> 
> 2015-03-10 21:40 GMT+01:00 Vijay Khemlani  <mailto:vkhem...@gmail.com>>:
> 
> Hmmm... what about the classic Google Analytics?
> 
> On Tue, Mar 10, 2015 at 5:04 PM, Andreas Kuhne
> mailto:andreas.ku...@suitopia.com>> wrote:
> 
> Hi all,
> 
> I would like to be able to track the number of visitors on our
> website. We previously had django-tracking installed and a munin
> node that tracked the information. Unfortunately we weren't able
> to continue using it because it broke our website somehow (I
> don't remember how). 
> 
> Does anyone have any ideas for how to create a similar
> functionality or a similar plugin that can be used?
> 
> Regards,
> 
> Andréas

Provided you're OK with a MySQL installation, you can always install
Piwik (http://piwik.org). Then you'd have direct access to the database
for reporting / analysis in realtime.

-- 
Nathan Clayton
nathanclay...@gmail.com

-- 
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/54FF83F5.4010605%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Subjectively Required Fields

2014-05-02 Thread Nathan McCorkle
JQuery doesn't solve validation on the backend though, so you'd still want
some logic there in case someone modifies or goes around the jQuery and
sends packets with bad data.
On Apr 29, 2014 12:11 AM, "Venkatraman S"  wrote:

> What do you mean by an invalid date? IF you are referring to the date
> format, then why not enforce a jquery datepicker and let the user choose
> from it - which would make sure that specified date is 'clean'.
>
> If not the above, a closer look at clean() method would help you ;)
>
>
> On Mon, Apr 28, 2014 at 4:58 PM, Daniel Watkins <
> dwatkins.gc...@googlemail.com> wrote:
>
>> Hello all,
>>
>> We're running in to an interesting validation problem.  We have a model
>> which represents a (specific type of) date interval, bounded by a start
>> date and end date. Both fields are optional, but if end date is specified
>> then start date must be specified. We are creating an instance of this
>> using a ModelForm.
>>
>> We initially tried to do this with the model's clean method:
>>
>> def clean(self):
>> if self.end_date and not self.start_date:
>> raise ValidationError('Start date must be specified if an end
>> date is specified.')
>>
>> This works fine if start date is not specified. However, the error is
>> also shown if an invalid date is given, along with the "Invalid date"
>> message against the field. This isn't really what we want (as it's not
>> especially user-friendly).
>>
>> I'm pretty sure that this is because the form strips out the invalid date
>> from the data it puts in to the model before this is validated, though I'm
>> not 100% sure on this.
>>
>> Is there any way we can achieve what we want with model validation, or
>> will we have to put the logic in to the form?
>>
>>
>> Cheers,
>>
>> Dan
>>
>> --
>> 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/468dc535-c494-4418-86c7-c857f66d130d%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/CAN7tdFQCVFaTtpUrgBmYo-K70V03Qi2v%2BDU-kmo2UE71faeYsg%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/CA%2B82U9%2BpH1fn%3D20cZQkn%3D3J9Lpc%3Dowp%2B_0g0fvgbRT5xTMHKnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I register to get access to the IRC Channel?

2014-04-07 Thread Nathan McCorkle
or just use freenode webchat

On Wed, Apr 2, 2014 at 1:59 PM, Aaron C. de Bruyn  wrote:
> Take a look at this:
>
> http://www.wikihow.com/Register-a-User-Name-on-Freenode
>
> If you still get stuck, let us know.
>
> -A
>
>
> On Wed, Apr 2, 2014 at 1:43 PM, John Draper  wrote:
>>
>> I go to Adium --> File --> irc.freenode.net
>> see screenshot
>>
>> I put in my nickname, hostname, and password.
>>
>> I get this   See 2nd screenshot...
>>
>> So what do I do next?I tried double clicking the item, and it just
>> goes back to the
>> first screenshot you see.   I tried Option-click,  Control-click, Command
>> click.
>>
>> But there is nothing I can do,  to bring up the channel?
>> I tried file --> new chat - that didnt work
>> I tried Status --> irc.freenode.net --> Available - that didnt work.
>>
>> And I don't see anything else,  that could give me any clue on how to join
>> the #django channel.
>>
>> HELP
>>
>> is there anyone out there who can "lead me by the hand" and help a fellow
>> Django beginner ask for help
>> over IRC?I'm on Fuze...   get the app...   http://fuze.com.   Send me
>> your Email, I invite you to the Conference
>> and we can screen share.   Skype used to be able to do that,  but not
>> since M$ bastardized it.
>>
>> John
>>
>>
>> --
>> 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/b03812e1-6e34-4c1a-87c3-a0a0fd722eba%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/CAEE%2BrGrJpdXA07UB-cJr%2B0eNMCQ-yk_egHQRSoWLtp%3D0xDJsJg%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
-Nathan

-- 
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/CA%2B82U9JCRTS0%3D8GxoLMVT8i8BG2JMsbV6ZnYB_efQ2Z3aPCY-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: tutorial part3 : polls didn't match URL patterns

2014-03-09 Thread frankel . nathan
AJ NOURI,

I had the exact same issue.  The trick for me was to edit the existing file 
at mysite/mysite/urls.py.  I had previously created a new file at 
mysite/urls.py (one directory up).  The code from the tutorial works for me 
now that I have it in the proper directory.  Your message was from a couple 
of months ago, I wanted to add this in case anyone is stuck at the same 
place.

Nathan


On Friday, January 10, 2014 12:40:25 AM UTC-8, AJ NOURI wrote:
>
> I have Python 2.7.3
>
> I am new in django and I am following the tutorial 3 at :
> https://docs.djangoproject.com/en/1.6/intro/tutorial03/
>
> I followed exactly the steps described:
>
> Here is a copy/paste from files in the project:
>
> *cat polls/views.py*
>
> from django.http import HttpResponse
>
> def index(request):
> return HttpResponse("Hello, world. You're at the poll index.")
>
> from /mysite: *cat urls.py*
>
> from django.conf.urls import patterns, include, url
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> url(r'^polls/', include('polls.urls')'),
> url(r'^admin/', include(admin.site.urls)'),
> )
>
> *cat polls/urls.py*
>
> from django.conf.urls import patterns, url
>
> from polls import views
>
> urlpatterns = patterns('',
> url(r'^$', views.index, name='index')
> )
>
> The page debug shows the following error: 
> [image: enter image description here]
>
>
> It looks like, *it doesn't recognize the "polls" pattern in 
> /mysite/urls.py.*
>
> Am I missing something?
>

-- 
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/be42c9ac-7cd8-416d-937b-300817a0fc8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: "ImportError: No module named django"

2013-04-16 Thread Nathan Hall
Ok, that was it, being completely unfamiliar with the Mac Terminal, I was
in the wrong directory. I navigated to the proper directory and got it
installed. Thanks for the help 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: "ImportError: No module named django"

2013-04-15 Thread Nathan Hall
I've never used pip or virtualenv.

When I did this: tar xzvf Django-1.5.1.tar.gz

I got this:
tar: Error opening archive: Failed to open 'Django-1.5.1.tar.gz'



On Mon, Apr 15, 2013 at 4:40 PM, Avraham Serour  wrote:

> doesn't pip and virtualenv work on mac?
>
>
> On Mon, Apr 15, 2013 at 11:37 PM, Larry Martell 
> wrote:
>
>> On Mon, Apr 15, 2013 at 2:34 PM, Nathan Hall  wrote:
>> > Yep, I've got admin access, it's my personal machine.
>> >
>> > Actually, I looked again and it may not have been a password issue,
>> this was
>> > the message I received: "python: can't open file 'setup.py': [Errno 2]
>> No
>> > such file or directory"
>>
>> Then you were not in the correct directory. Follow the instructions on
>> this page:
>>
>> https://www.djangoproject.com/download/
>
>

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




Re: "ImportError: No module named django"

2013-04-15 Thread Nathan Hall
Yep, I've got admin access, it's my personal machine.

Actually, I looked again and it may not have been a password issue, this
was the message I received: "python: can't open file 'setup.py': [Errno 2]
No such file or directory"

On Mon, Apr 15, 2013 at 4:29 PM, Larry Martell wrote:

> On Mon, Apr 15, 2013 at 2:24 PM, Nathan Hall  wrote:
> > I tried my password, it doesn't work.
>
> Go to System Preferences, Users and Groups. Is your account an Admin
> account? If not, you can't sudo. You'll need someone with an admin
> account to install it for you. But if you don't have an admin account
> how is it that you 'dropped the Django directory into
> /Library/Python/2.7/site-packages?' You'd need root access to do that.

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




Re: "ImportError: No module named django"

2013-04-15 Thread Nathan Hall
I tried my password, it doesn't work.

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




Re: "ImportError: No module named django"

2013-04-15 Thread Nathan Hall
Yep, I'm on 10.8.3. I tried sudo python setup.py install and it asked for a
password. I assumed it was just looking for my system password but that
didn't work.

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




Re: invalid literal for int() with base 10

2012-10-22 Thread Nathan Knight
Just so you know, it is bad practice to use "import * " when importing 
modules in python.
With many modules being used, you can run into conflicting definitions. 
Plus, it increases overhead - potentially an exponential decrease in 
performance! 

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



Re: How do I prevent messages getting cached?

2011-12-19 Thread nathan
Thanks Torsten. This seems to be what I was looking for.

On Dec 20, 12:11 am, Torsten Bronger 
wrote:
> Hall chen!
>
> Nathan Geffen writes:
> > I am using per-view caching in version 1.3 and would prefer to avoid
> > caching in my templates as far as possible. However, I've hit a snag.
> > If the messaging framework generates a message for a cached view, one
> > of two things happen:
>
> > 1. If the page is not yet in cache, the page gets cached with the
> > message in it. So next time a user goes to the page, they get an old
> > message.
>
> > 2. If the page is already in cache, the message isn't displayed.
>
> I thinkhttps://code.djangoproject.com/ticket/13894is related to
> this.
>
> Tsch ,
> Torsten.
>
> --
> Torsten Bronger    Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>                                   orhttp://bronger-jmp.appspot.com

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



How do I prevent messages getting cached?

2011-12-18 Thread Nathan Geffen
Hi

I am using per-view caching in version 1.3 and would prefer to avoid
caching in my templates as far as possible. However, I've hit a snag.
If the messaging framework generates a message for a cached view, one
of two things happen:

1. If the page is not yet in cache, the page gets cached with the
message in it. So next time a user goes to the page, they get an old
message.

2. If the page is already in cache, the message isn't displayed.

Is there a simple way to address this? Perhaps something I can put in
a vary_on_headers decoration? Or is there a simple way to tell Django
to put the message into a query string so that the page with the
message is cached separately from the page without the message?

Thanks.

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



Re: Bulk import of data

2011-12-03 Thread Nathan McCorkle
On Fri, Dec 2, 2011 at 6:22 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Faster in what sense? Prototyping/development time, or run time?

Well I can count the lines in each file in a few seconds, so I think
the SQL stuff is slowing everything down (using postgres through
psycodb2)

>
> If it's only a few MB, I see little reason to go as far as to writing it in
> C. Unless you are performing the same import tens of thousands of times, and
> the overhead in Python adds up so much that you get problems.
>
> But, quite frankly, you'll max out MySQL INSERT performance before you max
> out Pythons performance lol - as long as you don't use the ORM for inserts
> :)

when you say 'as long as you don't use the ORM for inserts', do you
mean don't do:
currentDataset.comment="blah"
currentDataset.name="abc12"
currentDataset.relatedObject=otherCurrentObject.id

etc,etc?

Are you saying I should be doing all that in python, but using raw SQL
instead of the fancy python object-like way? like this:
https://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly

>
> Cal
>
>
> On Fri, Dec 2, 2011 at 5:21 AM, Nathan McCorkle  wrote:
>>
>> would interfacing with SQL via C or C++ be faster to parse and load
>> data in bulk? I have files that are only a few MB worth of text, but
>> can take hours to load due to the amount of parsing I do, and the
>> number of database entries each item in a file makes
>>
>> On Mon, Nov 28, 2011 at 3:28 AM, Anler Hernandez Peral
>>  wrote:
>> > Hi, this is probably not your case, but in case it is, here is my story:
>> > Creating a script for import CSV files is the best solution as long as
>> > they
>> > are few, but in my case, the problem was that I need to import nearly 40
>> > VERY BIG CSV files, each one mapping a database table, and I needed to
>> > do it
>> > quickly. I thought that the best way was to use MySQL's "load data in
>> > local..." functionality since it works very fast and I could create only
>> > one
>> > function to import all the files. The problem was that my CSV files were
>> > pretty big and my database server were eating big amounts of memory and
>> > crashing my site so I ended up slicing each file in smaller chunks.
>> > Again, this is a very specific need, but in case you find yourself in
>> > such
>> > situation, here's my base code from which you can extend ;)
>> >
>> > https://gist.github.com/1dc28cd496d52ad67b29
>> > --
>> > anler
>> >
>> >
>> > On Sun, Nov 27, 2011 at 7:56 PM, Andre Terra 
>> > wrote:
>> >>
>> >> This should be run asynchronously (i.e. celery) when importing large
>> >> files.
>> >> If you have a lot of categories/subcategories, you will need to bulk
>> >> insert them instead of looping through the data and just using
>> >> get_or_create. A single, long transaction will definitely bring great
>> >> improvements to speed.
>> >> One tool is DSE, which I've mentioned before.
>> >> Good luck!
>> >>
>> >> Cheers,
>> >> AT
>> >>
>> >> On Sat, Nov 26, 2011 at 8:44 PM, Petr Přikryl  wrote:
>> >>>
>> >>> >>> import csv
>> >>> >>> data = csv.reader(open('/path/to/csv', 'r'), delimiter=';')
>> >>> >>> for row in data:
>> >>> >>> category = Category.objects.get_or_create(name=row[0])
>> >>> >>> sub_category = SubCategory.objects.get_or_create(name=row[1],
>> >>> >>> defaults={'parent_category': category})
>> >>> >>> product = Product.objects.get_or_create(name=row[2],
>> >>> >>> defaults={'sub_category': sub_category})
>> >>>
>> >>> There are few potential problems with the cvs as used here.
>> >>>
>> >>> Firstly, the file should be opened in binary mode.  In Unix-based
>> >>> systems, the binary mode is technically similar to text mode.
>> >>> However, you may once observe problems when you move
>> >>> the code to another environment (Windows).
>> >>>
>> >>> Secondly, the opened file should always be closed -- especially
>> >>> when building application (web) that may run for a long time.
>> >>> You can do it like this:
>> >>>
>> >>> ...
>> >

Re: Bulk import of data

2011-12-01 Thread Nathan McCorkle
would interfacing with SQL via C or C++ be faster to parse and load
data in bulk? I have files that are only a few MB worth of text, but
can take hours to load due to the amount of parsing I do, and the
number of database entries each item in a file makes

On Mon, Nov 28, 2011 at 3:28 AM, Anler Hernandez Peral
 wrote:
> Hi, this is probably not your case, but in case it is, here is my story:
> Creating a script for import CSV files is the best solution as long as they
> are few, but in my case, the problem was that I need to import nearly 40
> VERY BIG CSV files, each one mapping a database table, and I needed to do it
> quickly. I thought that the best way was to use MySQL's "load data in
> local..." functionality since it works very fast and I could create only one
> function to import all the files. The problem was that my CSV files were
> pretty big and my database server were eating big amounts of memory and
> crashing my site so I ended up slicing each file in smaller chunks.
> Again, this is a very specific need, but in case you find yourself in such
> situation, here's my base code from which you can extend ;)
>
> https://gist.github.com/1dc28cd496d52ad67b29
> --
> anler
>
>
> On Sun, Nov 27, 2011 at 7:56 PM, Andre Terra  wrote:
>>
>> This should be run asynchronously (i.e. celery) when importing large
>> files.
>> If you have a lot of categories/subcategories, you will need to bulk
>> insert them instead of looping through the data and just using
>> get_or_create. A single, long transaction will definitely bring great
>> improvements to speed.
>> One tool is DSE, which I've mentioned before.
>> Good luck!
>>
>> Cheers,
>> AT
>>
>> On Sat, Nov 26, 2011 at 8:44 PM, Petr Přikryl  wrote:
>>>
>>> >>> import csv
>>> >>> data = csv.reader(open('/path/to/csv', 'r'), delimiter=';')
>>> >>> for row in data:
>>> >>> category = Category.objects.get_or_create(name=row[0])
>>> >>> sub_category = SubCategory.objects.get_or_create(name=row[1],
>>> >>> defaults={'parent_category': category})
>>> >>> product = Product.objects.get_or_create(name=row[2],
>>> >>> defaults={'sub_category': sub_category})
>>>
>>> There are few potential problems with the cvs as used here.
>>>
>>> Firstly, the file should be opened in binary mode.  In Unix-based
>>> systems, the binary mode is technically similar to text mode.
>>> However, you may once observe problems when you move
>>> the code to another environment (Windows).
>>>
>>> Secondly, the opened file should always be closed -- especially
>>> when building application (web) that may run for a long time.
>>> You can do it like this:
>>>
>>> ...
>>> f = open('/path/to/csv', 'rb')
>>> data = csv.reader(f, delimiter=';')
>>> for ...
>>> ...
>>> f.close()
>>>
>>> Or you can use the new Python construct "with".
>>>
>>> P.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@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@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@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@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Nathan McCorkle
Rochester Institute of Technology
College of Science, Biotechnology/Bioinformatics

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



Re: Need to process uploaded files into database entries(takes hours), how do I return a progress bar?

2011-11-27 Thread Nathan McCorkle
using guest on rabbitMQ, installed django-celery using pip... my task
returns true/false if it succeeds/fails... otherwise it does a lot of
database R/W

Its currently processing a file via the worker, and I'm able to
refresh the web browser on a page that shows how many genes have been
processed for a dataset... every refresh the number of genes is
increasing... so I guess there aren't any DB clash problems!
(hopefully)

now to implement a javascript/AJAX progress bar to start after the
upload finishes!

On Sun, Nov 27, 2011 at 11:49 PM, Brian Schott  wrote:
> What are your settings?  Using carrot?  Kombu?  RabbitMQ?
>
> Does your task try to return a value?
>
> Sent from my iPhone
>
> On Nov 27, 2011, at 11:22 PM, Nathan McCorkle  wrote:
>
>> P.S. the printGene function works... printing the messages on the
>> celeryd console terminal... the processXLS1 function doesn't even
>> print anything at all
>>
>> On Sun, Nov 27, 2011 at 11:21 PM, Nathan McCorkle  wrote:
>>> Yeah I've seen the djcelery solution before... I've tried implementing
>>> it, but I'm getting an error on the celeryd console:
>>> TypeError: processXLS1() got an unexpected keyword argument 'task_is_eager'
>>>
>>> when I try running processXLS1.delay(dataObjectID=someInteger) from a
>>> function in views.py
>>>
>>> here's what's in my tasks.py:
>>> "
>>> from celery.decorators import task
>>> from enzymeFilter.models import *
>>> from django.db import transaction
>>>
>>> @task
>>> def printGene(y):
>>>        print "ppp"
>>>        fil=open('/var/www/media/testFile','w')
>>>        fil.write('coming from background')
>>>        fil.close()
>>>
>>>        print Gene.objects.get(id=y+1)
>>>        return True
>>>
>>> @task
>>> @transaction.commit_manually
>>> def processXLS1(datasetObjectID):
>>>        print "processing XLS as task"
>>>        datasetObject = Dataset.objects.get(id=datasetObjectID)
>>>        try:
>>>            ... more processing code
>>> "
>>>
>>> thanks
>>> -Nathan
>>>
>>> On Sun, Nov 27, 2011 at 9:52 PM, Brian Schott  wrote:
>>>> You really should look at django-celery and RabbitMQ.  The upload submit 
>>>> can initiate a task that is defined in tasks.py.  There are separate 
>>>> worker processes that pick up the task from the message queue and do the 
>>>> actual work.  These workers don't even have to be on the same machine with 
>>>> rabbitMQ so you get instant scalability.   Then your AJAX job status view 
>>>> can poll a job status table that is updated by the task and you don't have 
>>>> to worry about threads.
>>>> https://github.com/ask/django-celery
>>>>
>>>> Brian Schott
>>>> bfsch...@gmail.com
>>>>
>>>>
>>>>
>>>> On Nov 27, 2011, at 8:54 PM, Nathan McCorkle wrote:
>>>>
>>>>> I'm using Django 1.3 and am processing 3 files into genes, proteins,
>>>>> and genomes for a tool I built... this processing usually takes
>>>>> between 5 minutes to a few hours, depending on the genome size.
>>>>>
>>>>> After uploading the files (10-100 MB), the upload view begins
>>>>> processing the files, without returning for a long time (causing my
>>>>> browser to ask me if I want to kill the plupload script).
>>>>>
>>>>> For the user of this app, they don't know if their upload failed or is
>>>>> processing, etc... so I'd think forking the processing function (or
>>>>> making it a new thread) is what needs to happen, then the view can
>>>>> return to the user, and the upload page can start doing AJAX requests
>>>>> to check to processing progress.
>>>>>
>>>>> I feel like I want to do this:
>>>>> http://www.artfulcode.net/articles/threading-django/
>>>>> but am scared of crashing because I've heard Django isn't threadsafe
>>>>> with transactions. (and my processing function is making DB
>>>>> transactions)
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "Django users" group.
>>>>> To post to 

Re: Need to process uploaded files into database entries(takes hours), how do I return a progress bar?

2011-11-27 Thread Nathan McCorkle
On Sun, Nov 27, 2011 at 11:21 PM, Nathan McCorkle  wrote:
> Yeah I've seen the djcelery solution before... I've tried implementing
> it, but I'm getting an error on the celeryd console:
> TypeError: processXLS1() got an unexpected keyword argument 'task_is_eager'

I couldn't find anything on this error via google... but once I
removed the manual transaction stuff (I was trying to speed things up
by doing transactions only after I did a bunch of database operations)
including the decorator above the function, it started working.


>
> when I try running processXLS1.delay(dataObjectID=someInteger) from a
> function in views.py
>
> here's what's in my tasks.py:
> "
> from celery.decorators import task
> from enzymeFilter.models import *
> from django.db import transaction
>
> @task
> def printGene(y):
>        print "ppp"
>        fil=open('/var/www/media/testFile','w')
>        fil.write('coming from background')
>        fil.close()
>
>        print Gene.objects.get(id=y+1)
>        return True
>
> @task
> @transaction.commit_manually
> def processXLS1(datasetObjectID):
>        print "processing XLS as task"
>        datasetObject = Dataset.objects.get(id=datasetObjectID)
>        try:
>            ... more processing code
> "
>
> thanks
> -Nathan
>
> On Sun, Nov 27, 2011 at 9:52 PM, Brian Schott  wrote:
>> You really should look at django-celery and RabbitMQ.  The upload submit can 
>> initiate a task that is defined in tasks.py.  There are separate worker 
>> processes that pick up the task from the message queue and do the actual 
>> work.  These workers don't even have to be on the same machine with rabbitMQ 
>> so you get instant scalability.   Then your AJAX job status view can poll a 
>> job status table that is updated by the task and you don't have to worry 
>> about threads.
>> https://github.com/ask/django-celery
>>
>> Brian Schott
>> bfsch...@gmail.com
>>
>>
>>
>> On Nov 27, 2011, at 8:54 PM, Nathan McCorkle wrote:
>>
>>> I'm using Django 1.3 and am processing 3 files into genes, proteins,
>>> and genomes for a tool I built... this processing usually takes
>>> between 5 minutes to a few hours, depending on the genome size.
>>>
>>> After uploading the files (10-100 MB), the upload view begins
>>> processing the files, without returning for a long time (causing my
>>> browser to ask me if I want to kill the plupload script).
>>>
>>> For the user of this app, they don't know if their upload failed or is
>>> processing, etc... so I'd think forking the processing function (or
>>> making it a new thread) is what needs to happen, then the view can
>>> return to the user, and the upload page can start doing AJAX requests
>>> to check to processing progress.
>>>
>>> I feel like I want to do this:
>>> http://www.artfulcode.net/articles/threading-django/
>>> but am scared of crashing because I've heard Django isn't threadsafe
>>> with transactions. (and my processing function is making DB
>>> transactions)
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users+unsubscr...@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@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
>
> --
> Nathan McCorkle
> Rochester Institute of Technology
> College of Science, Biotechnology/Bioinformatics
>



-- 
Nathan McCorkle
Rochester Institute of Technology
College of Science, Biotechnology/Bioinformatics

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



Re: Need to process uploaded files into database entries(takes hours), how do I return a progress bar?

2011-11-27 Thread Nathan McCorkle
P.S. the printGene function works... printing the messages on the
celeryd console terminal... the processXLS1 function doesn't even
print anything at all

On Sun, Nov 27, 2011 at 11:21 PM, Nathan McCorkle  wrote:
> Yeah I've seen the djcelery solution before... I've tried implementing
> it, but I'm getting an error on the celeryd console:
> TypeError: processXLS1() got an unexpected keyword argument 'task_is_eager'
>
> when I try running processXLS1.delay(dataObjectID=someInteger) from a
> function in views.py
>
> here's what's in my tasks.py:
> "
> from celery.decorators import task
> from enzymeFilter.models import *
> from django.db import transaction
>
> @task
> def printGene(y):
>        print "ppp"
>        fil=open('/var/www/media/testFile','w')
>        fil.write('coming from background')
>        fil.close()
>
>        print Gene.objects.get(id=y+1)
>        return True
>
> @task
> @transaction.commit_manually
> def processXLS1(datasetObjectID):
>        print "processing XLS as task"
>        datasetObject = Dataset.objects.get(id=datasetObjectID)
>        try:
>            ... more processing code
> "
>
> thanks
> -Nathan
>
> On Sun, Nov 27, 2011 at 9:52 PM, Brian Schott  wrote:
>> You really should look at django-celery and RabbitMQ.  The upload submit can 
>> initiate a task that is defined in tasks.py.  There are separate worker 
>> processes that pick up the task from the message queue and do the actual 
>> work.  These workers don't even have to be on the same machine with rabbitMQ 
>> so you get instant scalability.   Then your AJAX job status view can poll a 
>> job status table that is updated by the task and you don't have to worry 
>> about threads.
>> https://github.com/ask/django-celery
>>
>> Brian Schott
>> bfsch...@gmail.com
>>
>>
>>
>> On Nov 27, 2011, at 8:54 PM, Nathan McCorkle wrote:
>>
>>> I'm using Django 1.3 and am processing 3 files into genes, proteins,
>>> and genomes for a tool I built... this processing usually takes
>>> between 5 minutes to a few hours, depending on the genome size.
>>>
>>> After uploading the files (10-100 MB), the upload view begins
>>> processing the files, without returning for a long time (causing my
>>> browser to ask me if I want to kill the plupload script).
>>>
>>> For the user of this app, they don't know if their upload failed or is
>>> processing, etc... so I'd think forking the processing function (or
>>> making it a new thread) is what needs to happen, then the view can
>>> return to the user, and the upload page can start doing AJAX requests
>>> to check to processing progress.
>>>
>>> I feel like I want to do this:
>>> http://www.artfulcode.net/articles/threading-django/
>>> but am scared of crashing because I've heard Django isn't threadsafe
>>> with transactions. (and my processing function is making DB
>>> transactions)
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users+unsubscr...@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@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
>
> --
> Nathan McCorkle
> Rochester Institute of Technology
> College of Science, Biotechnology/Bioinformatics
>



-- 
Nathan McCorkle
Rochester Institute of Technology
College of Science, Biotechnology/Bioinformatics

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



Re: Need to process uploaded files into database entries(takes hours), how do I return a progress bar?

2011-11-27 Thread Nathan McCorkle
Yeah I've seen the djcelery solution before... I've tried implementing
it, but I'm getting an error on the celeryd console:
TypeError: processXLS1() got an unexpected keyword argument 'task_is_eager'

when I try running processXLS1.delay(dataObjectID=someInteger) from a
function in views.py

here's what's in my tasks.py:
"
from celery.decorators import task
from enzymeFilter.models import *
from django.db import transaction

@task
def printGene(y):
print "ppp"
fil=open('/var/www/media/testFile','w')
fil.write('coming from background')
fil.close()

print Gene.objects.get(id=y+1)
return True

@task
@transaction.commit_manually
def processXLS1(datasetObjectID):
print "processing XLS as task"
datasetObject = Dataset.objects.get(id=datasetObjectID)
try:
... more processing code
"

thanks
-Nathan

On Sun, Nov 27, 2011 at 9:52 PM, Brian Schott  wrote:
> You really should look at django-celery and RabbitMQ.  The upload submit can 
> initiate a task that is defined in tasks.py.  There are separate worker 
> processes that pick up the task from the message queue and do the actual 
> work.  These workers don't even have to be on the same machine with rabbitMQ 
> so you get instant scalability.   Then your AJAX job status view can poll a 
> job status table that is updated by the task and you don't have to worry 
> about threads.
> https://github.com/ask/django-celery
>
> Brian Schott
> bfsch...@gmail.com
>
>
>
> On Nov 27, 2011, at 8:54 PM, Nathan McCorkle wrote:
>
>> I'm using Django 1.3 and am processing 3 files into genes, proteins,
>> and genomes for a tool I built... this processing usually takes
>> between 5 minutes to a few hours, depending on the genome size.
>>
>> After uploading the files (10-100 MB), the upload view begins
>> processing the files, without returning for a long time (causing my
>> browser to ask me if I want to kill the plupload script).
>>
>> For the user of this app, they don't know if their upload failed or is
>> processing, etc... so I'd think forking the processing function (or
>> making it a new thread) is what needs to happen, then the view can
>> return to the user, and the upload page can start doing AJAX requests
>> to check to processing progress.
>>
>> I feel like I want to do this:
>> http://www.artfulcode.net/articles/threading-django/
>> but am scared of crashing because I've heard Django isn't threadsafe
>> with transactions. (and my processing function is making DB
>> transactions)
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@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@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Nathan McCorkle
Rochester Institute of Technology
College of Science, Biotechnology/Bioinformatics

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



Need to process uploaded files into database entries(takes hours), how do I return a progress bar?

2011-11-27 Thread Nathan McCorkle
I'm using Django 1.3 and am processing 3 files into genes, proteins,
and genomes for a tool I built... this processing usually takes
between 5 minutes to a few hours, depending on the genome size.

After uploading the files (10-100 MB), the upload view begins
processing the files, without returning for a long time (causing my
browser to ask me if I want to kill the plupload script).

For the user of this app, they don't know if their upload failed or is
processing, etc... so I'd think forking the processing function (or
making it a new thread) is what needs to happen, then the view can
return to the user, and the upload page can start doing AJAX requests
to check to processing progress.

I feel like I want to do this:
http://www.artfulcode.net/articles/threading-django/
but am scared of crashing because I've heard Django isn't threadsafe
with transactions. (and my processing function is making DB
transactions)

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



Field.to_python not working as expected for me...

2011-11-21 Thread Nathan Hoad
I've written a custom field (I'm using Django nonrel) for storing
users in a SetField. The SetField doesn't seem to handle serialising
the set of User objects properly, so what I've done is implement the
pre_save method, which returns a set of strings which are the ids in
MongoDB.

The documentation states that pre_save is for converting complex
Python types to database types, which is working great. The problem
is, the documentation states this for Field.to_python; "Converts a
value as returned by your database (or a serializer) to a Python
object."

I'd expect that the database is returning a set of strings (which are
the ids) but it's actually returning a list of User objects. From
this, I would then expect that accessing the field on a model would
return a set of User objects, but it's returning a set of string
objects.

So to_python is receiving and returning a set of User objects, but
accessing the model's users attribute returns the raw database value.
How can I get my custom field to return the set of User objects
properly?

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



Re: Performance of process_template_response for corporate branding

2011-08-18 Thread Nathan Hoad
To answer my own question;

I performed some tests with the Apache benchmarking tool. I performed
5000 requests over 10 threads to a local server running lighttpd with
FastCGI, multiple passes over a few hours, with my middleware disabled
for one pass and disabled for another.

The passes were both on par, as I was hoping/expecting they would be.
The average difference was something like 2 seconds, with the enabled
middleware being the faster one usually. Obviously this means nothing,
and they're both on par and there's nothing to worry about.

On Aug 18, 1:11 pm, Nathan Hoad  wrote:
> I have a project at the moment that requires a lot of corporate
> branding as well as internationalisation/translations etc. Basically
> the way the system currently works is that it performs the
> translations, then applies branding for specific distributors.
>
> Now we're developing a web-based front end using Django, and of course
> the same rules still apply. I have a solution at the moment that uses
> a very minimalist middleware, which is called after the translations
> are performed, using the process_template_response method.
>
> Of course, it's working all fine, but I'm wondering about the
> performance hit from what's essentially 10-20 of str.replace()
> methods? The alternative is to create my own wrapper for Django's
> translation package, but after looking at the code I'm not big on that
> idea.
>
> If anyone has any alternative solutions, don't hesitate to share!

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



Performance of process_template_response for corporate branding

2011-08-17 Thread Nathan Hoad
I have a project at the moment that requires a lot of corporate
branding as well as internationalisation/translations etc. Basically
the way the system currently works is that it performs the
translations, then applies branding for specific distributors.

Now we're developing a web-based front end using Django, and of course
the same rules still apply. I have a solution at the moment that uses
a very minimalist middleware, which is called after the translations
are performed, using the process_template_response method.

Of course, it's working all fine, but I'm wondering about the
performance hit from what's essentially 10-20 of str.replace()
methods? The alternative is to create my own wrapper for Django's
translation package, but after looking at the code I'm not big on that
idea.

If anyone has any alternative solutions, don't hesitate to share!

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



Re: Django NoSQL support status?

2011-08-11 Thread Nathan Hoad
Hmm, silly me. I posted this to the users group, not the developers
group. My mistake!

On Aug 12, 1:18 pm, Nathan Hoad  wrote:
> Hi guys, just wondering what the status is on the official NoSQL
> support? I've done a lot of reading and the last official post I can
> see is Alex Gaynor's GSoC post, from August last year mentioning the
> Query refactor and how it should help down the road for NoSQL, but
> nothing past that.
>
> Basically, I'm just wondering what, if anything, is being done about
> it?
>
> Thanks,
>
> Nathan.

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



Django NoSQL support status?

2011-08-11 Thread Nathan Hoad
Hi guys, just wondering what the status is on the official NoSQL
support? I've done a lot of reading and the last official post I can
see is Alex Gaynor's GSoC post, from August last year mentioning the
Query refactor and how it should help down the road for NoSQL, but
nothing past that.

Basically, I'm just wondering what, if anything, is being done about
it?

Thanks,

Nathan.

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



Re: Weird Django "caching" problem

2011-07-16 Thread Nathan Hoad
Great! Thanks heaps for that. All fixed.

On Jul 17, 3:04 am, Nan  wrote:
> If clearing your browser cache fixes it, then it's browser caching,
> not Django caching.  It's possible your PHP site was sending cache
> suppression headers.  If you want to prevent browser and proxy
> caching, look into Django's never_cache decorator.
>
> On Jul 16, 9:51 am, Nathan Hoad  wrote:
>
>
>
>
>
>
>
> > Hi guys, I migrated my site from PHP to Django about a fortnight ago
> > and everything went really smoothly, except now there appears to be
> > some kind of "caching" on certain pages. I say "caching" because I
> > have no caching enabled in Django, and it seems to be browser based,
> > i.e. I can open a page in any browser, three days later go back to the
> > same page, and be presented with the old data. But if I force refresh
> > or clear the cache for any of these browsers, then the new data
> > appears (which is no good for typical users). The reason I think this
> > problem has to do with Django is that it didn't happen at all with the
> > old PHP site.
>
> > I've narrowed it down to being only the pages using a generic view,
> > which made me think that the queryset is only being evaluated once.
> > But then, as I said above, I can force refresh a page and see the new
> > data, so this makes me think they're being evaluated more than once.
>
> > I'm pretty new to Django, so I don't fully know what I should do to
> > try and remedy a problem like this. Any help or guidance would be
> > great. Thanks guys.

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



Weird Django "caching" problem

2011-07-16 Thread Nathan Hoad
Hi guys, I migrated my site from PHP to Django about a fortnight ago
and everything went really smoothly, except now there appears to be
some kind of "caching" on certain pages. I say "caching" because I
have no caching enabled in Django, and it seems to be browser based,
i.e. I can open a page in any browser, three days later go back to the
same page, and be presented with the old data. But if I force refresh
or clear the cache for any of these browsers, then the new data
appears (which is no good for typical users). The reason I think this
problem has to do with Django is that it didn't happen at all with the
old PHP site.

I've narrowed it down to being only the pages using a generic view,
which made me think that the queryset is only being evaluated once.
But then, as I said above, I can force refresh a page and see the new
data, so this makes me think they're being evaluated more than once.

I'm pretty new to Django, so I don't fully know what I should do to
try and remedy a problem like this. Any help or guidance would be
great. Thanks guys.

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



Can the admin be configured to save generic content types with the id of the base model of an inherited model

2011-06-01 Thread Nathan Geffen
Hi

I hope this question isn't too obscure.

I have a base model  (not abstract) called BasicPost. I have a model
inheriting from it called PostWithImage. BasicPost has a couple of  generic
relations.

In models.py:

class BasicPost(models.Model):
   ...
   authors = generic.GenericRelation(OrderedCredit,
verbose_name=_('authors'),
  blank=True, null=True)
   ...
   tags = generic.GenericRelation(TaggedItem, verbose_name=_('tags'),
  blank=True, null=True)
   ...

class PostWithImage(BasicPost):
   ...

In admin.py:

class TaggedItemInline(generic.GenericTabularInline):
...
model = TaggedItem
...

class OrderedCreditInline(generic.GenericTabularInline):
   ... # same concept as above

class BasicPostAdmin(admin.ModelAdmin):
inlines = [OrderedCreditInline, TaggedItemInline]


class PostWithImageAdmin(BasicPostAdmin):
...

When I save an object on the PostWithImage admin screen, it sets the
content_type of my generic fields equal to PostWithImage. However if I want
to now retrieve all posts (irrespective of whether they're a BasicPost,
PostWithImage or any other kind of post) with a particular tag, I run into
problems. No simple query will do it, because the tags are pointing to a
bunch of different models. I have found a workaround, but it's ugly and make
expensive database hits. Is there a way I can coerce the admin interface
into saving the tags with content_type pointing to the base class, i.e.
BasicPost?

Thanks.

Regards
Nathan

PS: Here's the ugly workaround. Very difficult for a programmer to decipher
and I suspect it generates very expensive database hits.


class BasicPost(models.Model)

def get_related_posts(self):
tags = self.tags.all()

return BasicPost.objects.filter(
pk__in=
[t.object_id for t in
TaggedItem.objects.filter(tag__name__in=[t.tag.name for
t in tags])
if isinstance(t.content_type.model_class()(),
BasicPost)])\
.select_subclasses().order_by('-date_published')

# Note that I'm using model_utils, hence the select_subclasses method.

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



Re: Disable debug logging for django.db.backends?

2011-05-30 Thread Nathan Duthoit
It's more of a hack than a clean solution but it works. Add the
following to your settings file:

import logging
logging.getLogger('django.db.backends').setLevel(logging.ERROR)

On May 24, 12:32 am, diafygi  wrote:
> Howdy all,
>
> I have DEBUG=True in my settings.py, and I have several logging
> entries in my project (Django 1.3)
>
> However, when I am testing, there are tons of django.db.backends debug
> entries that appear, and my logs gets lost in the shuffle.
>
> Is there a way to disable django.db.backends in my settings.py? What
> is an example?
>
> Thanks,
> Daniel

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



XML parsing

2011-01-31 Thread sami nathan
HI
   I am trying to parse my response  by the following method
  elif request.method == 'POST':
   reqp=request.raw_post_data
   response = HttpResponse(mimetype='text/xml')
   response.write(reqp)
   print response
   xmldoc = minidom.parse('binary.xml')
   reflist = xmldoc.getElementsByTagName('message')
   print reflist
   return response
 But its giving me error of "TO MANY VALUE TO UNPACK"
--
my request looks like this

http://sc
hemas.xmlsoap.org/soap/envelope/
">http://flypp.infy.com/sms/v2010r1_0
">1234534366<
applicationID>1t1p
1p2DICT
test


Now my ultimate aim is to send error  response to client sending me the
above request without DICT in message

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



QUERYDICT immutable

2011-01-28 Thread sami nathan
HI
  I am NEWBIE  i am trying to run  an  server and my POST request is from
java api(client) and i cant able to see exact error in java api its just
showing HTML request is not accepting in java b coz django giving me error
iin html format but by some how i manage to print request.POST from my
request
-
--
http://schemas.xmlsoap.org/soap/envelope/
">http://flypp.infy.com/sms/v2010r1_0
">12345343661t1p1p2<
messa
ge>DICT test
']}>
--
--
now i want to change just message in my request.POST (denoted by red color
in above request) and i am helpless  i tried the following code

def recive_ShortMessage(request):
if request.method == 'POST':
 request=request.POST.QueryDict.copy()
 qt=request.QueryDict.copy()
 print qt
 qt['message'] = 'I am changing it!'
 return HttpResponse(qt)
_
_

As java api is not showing  what error i am having i can know error in this
program

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



Re: Django and Oracle XE - Empty models file

2011-01-28 Thread Nathan
Cheers for the reply. The database in question is a remote database. I 
presume by Django user that you're referring to the local user account? 
Otherwise the user credentials in settings should be adequate. 

I'm guessing the only resolution to this is to hand craft the models?

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



Re: parsing SOAP request

2011-01-26 Thread sami nathan
Hi
Now i tried to parse the incoming request and send my response i tried
in the following way by  just sending what request came as it as response
(ECHO server).and i am very newbie i dont know how to parse the request. I
used ZSI sucessfully but in that requset was handled by itself but ZSI
application is not accepting in django

My view looks like this :
def recive_ShortMessage(request):
if request.method == 'GET':
   ref= "Process  in progress"
   return HttpResponse(ref)
elif request.method == 'POST':
print request.POST.QueryDict
return HttpResponse (request.POST)

But the error is
org.apache.axis2.AxisFault:  in xml declaration
 at [row,col {unknown-source}]: [1,13]

(I am using java client)

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



parsing SOAP request

2011-01-26 Thread sami nathan
Hi
   i am working web service i am getting SOAP(POST) request from client now
i am trying to parse the request xml and sending the response my soap
request is

http://schemas.xmlsoap.org/soap/envelope/
">http://flypp.infy.com/sms/v2010r1_0
">12345343661t1p1p2DICT
test']}>
response
 now i want send response as change is denoted in colors
**'http://schemas.xmlsoap.org/soap/envelope/
">http://flypp.infy.com/sms/v2010r1_0
">12345343661t1p1p2TEXT HERE
']}>

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



Re: WEB SERVICE

2011-01-25 Thread sami nathan
HI
   Now i am getting some way but i still cant parse the incoming request  my
view looks like this at present i am trying to send the request i am getting

from xml.dom import minidom
import urllib
import socket
from django.http import HttpResponse
from django.core import serializers
import urllib
import socket


def recive_ShortMessage(request):
if request.method == 'GET':
   ref= "Process  in progress"
   return HttpResponse(ref)
elif request.method == 'POST':
 print request
 socket.setdefaulttimeout(20)
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 request.message=['brave']
 print request.message
 XMLSerializer = serializers.get_serializer("xml")
 xml_serializer = XMLSerializer()
 xml_serializer.serialize(request)
 data = xml_serializer.getvalue()
 print data
 return HttpResponse(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@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



WEB SERVICE

2011-01-23 Thread sami nathan
Hi
  i want to do web service in using django  My client is sending SOAP
request and should send response as SOAP response i am now sucessful in this
process using ZSI but i want to run the process in django server So i
refered http://djangosnippets.org/snippets/979/ now it would be helpfull for
me if i get help of running echo server  using the same example

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



Re: ZSI WEB SERVICE

2011-01-06 Thread sami nathan
Ya me too in the same problem if any one find the solution please post here

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



Re: ZSI WEB SERVICE

2010-12-18 Thread sami nathan
"""__init__() must be called with TypeCode instance as first argument
(got String instance instead) """what this error says when i overriden
the ZSI server file (generated using wsdl2py in ZSI) i got this error
is there any one to say what this
error says I am trying to act as  server

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



Re: get request from an java API to DJango

2010-12-18 Thread sami nathan
But i should act as an server will suds allow that?

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



Re: get request from an java API to DJango

2010-12-18 Thread sami nathan
 thanks for notification.Please guide me through a source to get a
grasp of suds and continue working.Suggest me a point to startwith.To
be honest i am completely new to this.

Regards,
Sami

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



ZSI WEB SERVICE

2010-12-18 Thread sami nathan
__init__() must be called with TypeCode instance as first argument
(got String instance instead) what this error says when i overriden
the ZSI server file i got this error is there any one to say what this
error says

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



get request from an java API to DJango

2010-12-17 Thread sami nathan
THANKS FOR NOTIFICATION
 Hi i am newbie to django i am having task that want to
get request from an java API and give Response to the same API (To act
as an server ) So i am having WSDL file for the JAVA API
I decided to do that in ZSI WEB SERVICE and i generated server file
using wsdl2py cmmd  and according to tutorial i am seeing i want to
overrriden the class in the server file but i am getting error Type
error unbound method __init__() must be called with TypeCode
instance as first argument (got String instance instead)" i am
getting word from that API and i am returning the same word   what
this error says clearly?  So i am  finding little bit difficult in the
ZSI is there Any other method to do the above task please suggest me
At last clearly now i need to get request from that API and parse it

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



urllib .urlopen problem

2010-12-14 Thread sami nathan
my django site was running successfully  but now it s giving me the
following error
 IO ERROR [Errno socket error] (11004, 'getaddrinfo failed'
my view looks like this and i am running in proxy settings but i
included that in my code

   proxie = {'http': 'http://192.168.1.100:8080'}
   word = request.GET['word']
   
message=urllib.urlopen('http://m.broov.com/wap/di/sub?word='+word+'&type=00submit=Submit',)
   socket.setdefaulttimeout(1120)
   sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   return HttpResponse(message)
ANd it would be gracefull if someone help me to build web service
using RESTfull to run server

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



Re: Query about GenericTabularInline

2010-12-08 Thread nathan
Sorry. Item 1 is my fault.
But I still haven't resolved item 2.

On Dec 7, 1:35 pm, Nathan Geffen  wrote:
> Hi
>
> I have set up a Generic inline (using generic.GenericTabularInline). It
> behaves differently (and from my application's point of view, wrongly) from
> the standard admin.TabularInline in two ways:
>
> 1. It doesn't have the plus icon next to foreign key fields that allows
> users to add new foreign objects directly from this view.
>
> 2. In settings.py I set TEMPLATE_STRING_IF_INVALID = 'PROGRAMMING ERROR!
> INVALID TEMPLATE STRING.'
> Unfortunately, this string then appears on the left of each entry in my
> GenericTabularInline.
>
> Have other people experienced this? If so, should I log this as a bug or am
> I doing something wrong or making a wrong assumption about how it should
> work?
>
> Thanks.
>
> Regards
> Nathan

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



WEB service using Restify

2010-12-07 Thread sami nathan
THANKS FOR NOTIFICATION

I am trying to do webservice with RESTfull web service but i dint create models

my view file looks like this
from django.http import *
import urllib

def current_datetime(request):
word = request.GET['word']

message=urllib.urlopen('http://m.broov.com/wap/di/sub?word='+word+'&type=00submit=Submit',)
return HttpResponse(message)

My url looks like this (r'^wap/di/sub/',current_datetime ),
i want to restify my view but all examples are showing oly models .py
 now i need help to do that
THANKS

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



Query about GenericTabularInline

2010-12-07 Thread Nathan Geffen
Hi

I have set up a Generic inline (using generic.GenericTabularInline). It
behaves differently (and from my application's point of view, wrongly) from
the standard admin.TabularInline in two ways:

1. It doesn't have the plus icon next to foreign key fields that allows
users to add new foreign objects directly from this view.

2. In settings.py I set TEMPLATE_STRING_IF_INVALID = 'PROGRAMMING ERROR!
INVALID TEMPLATE STRING.'
Unfortunately, this string then appears on the left of each entry in my
GenericTabularInline.

Have other people experienced this? If so, should I log this as a bug or am
I doing something wrong or making a wrong assumption about how it should
work?

Thanks.

Regards
Nathan

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



Re: WEB SERVICE IN DJANGO USING ZSI

2010-11-29 Thread sami nathan
ANY one knows how to generate server.py flie from wsdl2py in ZSI

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



Re: WEB SERVICE IN DJANGO USING ZSI

2010-11-29 Thread sami nathan
To create server file i used this command but showing following error
D:\Python25\Scripts>python wsdl2py --complexType localhost 8080 d:/soap/zz/FlypS
ms.wsdl
Expecting a file/url as argument (WSDL).
Traceback (most recent call last):
  File "wsdl2py", line 9, in 
wsdl2py()
  File "D:\Python25\Lib\site-packages\ZSI\generate\commands.py", line 122, in ws
dl2py
sys.exit(os.EX_USAGE)
AttributeError: 'module' object has no attribute 'EX_USAGE'

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



WEB SERVICE IN DJANGO USING ZSI

2010-11-28 Thread sami nathan
To genrate sevice file from my wsdl i used following command but it
shows the same


D:\Python25\Scripts>wsdl2py --complexType --file=ZonedLocation.wsdl
'wsdl2py' is not recognized as an internal or external command,
operable program or batch file.
 but my wsdl2py is in the scripts oly

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



Re: WEB SERVICE IN DJANGO USING ZSI

2010-11-27 Thread sami nathan
But i am not havin python intreptor i use my command prompt this way
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\ezhil>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on wi
32
Type "help", "copyright", "credits" or "license" for more information.
>>> wsdl2py --extende --file=D:\soap\FlyppSms.wsdl
  File "", line 1
wsdl2py --extende --file=D:\soap\FlyppSms.wsdl
  ^
SyntaxError: invalid syntax
>>>




shouldn't i use this way

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



Re: WEB SERVICE IN DJANGO USING ZSI

2010-11-27 Thread sami nathan
for creating server.py from wsdl file i am using this following code i
dont na weather its right but its not creating any file but its
throwing error
>>> wsdl2py --extended --file=D;\soap\FlyppSms.wsdl
  File "", line 1
wsdl2py --extended --file=D;\soap\FlyppSms.wsdl
   ^
SyntaxError: unexpected character after line continuation character

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



Re: WEB SERVICE IN DJANGO USING SOAP

2010-11-27 Thread sami nathan
After opening and closing also showing me the same result i cant say
not to output the BOM to generator b coz its an another person who
generated and gave to me and asking me to create web service using
just wsdl file and given me open choice of use rather SOAP or REST i
also decided to use REST now will u refer me the tutorial to rest and
also to solve above problem

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



Re: WEB SERVICE IN DJANGO USING SOAP

2010-11-26 Thread sami nathan
encoding="UTF-8"?> should i remove this from wsdl file...? and more
over i am trying to use my system as  server i am refering dive into
python chapter 12 introspecting wsdl and searching google i cant find
weather its an client side code or server side code but i am in need
of server side code do u find any refrence for me to study server side
code using SOAP or REST sorry if i had asked anything wrong i am
newbee

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



WEB SERVICE IN DJANGO USING SOAP

2010-11-26 Thread sami nathan
Thanks for notification I am trying to develop web service using
django with soap interface i checked my code in python to open wsdl
file but its showing error i am sure that wsdl file dosent have any
errors this is my code>>> from SOAPpy import WSDL
>> server=WSDL.Proxy('D/soap/FlyppSms.wsdl')
Traceback (most recent call last):
  File "", line 1, in 
  File "D:\Python25\Lib\site-packages\SOAPpy\WSDL.py", line 67, in __init__
self.wsdl = reader.loadFromString(str(wsdlsource))
  File "D:\Python25\Lib\site-packages\SOAPpy\wstools\WSDLTools.py", line 47, in
loadFromString
return self.loadFromStream(StringIO(data))
  File "D:\Python25\Lib\site-packages\SOAPpy\wstools\WSDLTools.py", line 28, in
loadFromStream
document = DOM.loadDocument(stream)
  File "D:\Python25\Lib\site-packages\SOAPpy\wstools\Utility.py", line 602, in l
oadDocument
return xml.dom.minidom.parse(data)
  File "D:\Python25\Lib\site-packages\_xmlplus\dom\minidom.py", line 1915, in pa
rse
return expatbuilder.parse(file)
  File "D:\Python25\Lib\site-packages\_xmlplus\dom\expatbuilder.py", line 930, i
n parse
result = builder.parseFile(file)
  File "D:\Python25\Lib\site-packages\_xmlplus\dom\expatbuilder.py", line 207, i
n parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 1

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



SERIALIZING

2010-11-03 Thread sami nathan
HOW TO GET XML RESPONSE in following
THIS IS HOW MY URL.PY LOOKS LIKE

from django.conf.urls.defaults import *
from it.view import current_datetime



# Uncomment the next two lines to enable the admin:
#from django.contrib import admin
#admin.autodiscover()


urlpatterns = patterns('',
  # Example:
   (r"^wap/di/sub/$",current_datetime),
  # Uncomment the admin/doc line below to enable admin documentation:
  # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

  # Uncomment the next line to enable the admin:
  # (r'^admin/', include(admin.site.urls)),
)

`~~~
My view .py looks like this

from django.http import *
import urllib
from django_restapi.responder import XMLResponder


def current_datetime(request):
  word = request.GET['word']
  message = 
urllib.urlopen('http://m.broov.com/wap/di/sub?word='+word+'&type=00submit=Submit',)
  return HttpResponse(message)

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



Re: Attributr error

2010-11-03 Thread sami nathan
i Think serialisation would be helpful for this some one help me how to use it

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



Re: Attributr error

2010-11-03 Thread sami nathan
HOW TO GET XML RESPONSE in following
THIS IS HOW MY URL.PY LOOKS LIKE

from django.conf.urls.defaults import *
from it.view import current_datetime



# Uncomment the next two lines to enable the admin:
#from django.contrib import admin
#admin.autodiscover()


urlpatterns = patterns('',
   # Example:
(r"^wap/di/sub/$",current_datetime),
   # Uncomment the admin/doc line below to enable admin documentation:
   # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

   # Uncomment the next line to enable the admin:
   # (r'^admin/', include(admin.site.urls)),
)

`~~~
My view .py looks like this

from django.http import *
import urllib
from django_restapi.responder import XMLResponder


def current_datetime(request):
   word = request.GET['word']
   message = 
urllib.urlopen('http://m.broov.com/wap/di/sub?word='+word+'&type=00submit=Submit',)
   return HttpResponse(message)

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



Re: Attributr error

2010-11-03 Thread sami nathan
Where should i use this please tell!! should i use in urls.py

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



Re: Attributr error

2010-11-02 Thread sami nathan
I want my final result in xml format and how can i do that? thanks for
notification

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



Attributr error

2010-11-02 Thread sami nathan
THIS IS HOW MY URL.PY LOOKS LIKE

from django.conf.urls.defaults import *
from it.view import current_datetime



# Uncomment the next two lines to enable the admin:
#from django.contrib import admin
#admin.autodiscover()


urlpatterns = patterns('',
# Example:
 (r"^wap/di/sub/$",current_datetime),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
)

`~~~
My view .py looks like this

from django.http import *
import urllib
from django_restapi.responder import XMLResponder


def current_datetime(request):
word = request.GET['word']
message = 
urllib.urlopen('http://m.broov.com/wap/di/sub?word='+word+'&type=00submit=Submit',)
return XMLResponder(message)

  But my error is
Exception Value:

'XMLResponder' object has no attribute 'status_code'

Exception Location:
D:\Python25\lib\site-packages\django\middleware\common.py in
process_response, line 94

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



ATTRIBUTE ERROR

2010-11-02 Thread sami nathan
If i am doing anything wrong forgive me i am newbe


MY error is
Exception Type: AttributeError
Exception Value:

'str' object has no attribute 'resolve'

Exception Location:
D:\Python25\lib\site-packages\django\core\urlresolvers.py in resolve,
line 25


My url.py  look like this
from django.conf.urls.defaults import *
from it.view import current_datetime

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Example:
 (r'^wap/di/sub/$",current_datetime')

# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
)
~~~
My view.py looks like this
from django.http import *
import urllib

def current_datetime(request):
word = request.GET['word']
message = 
urllib.urlopen('http://m.broov.com/wap/di/sub?word='+word+'&type=00submit=Submit',)
return HttpResponse (message)
~~
Thank u for notification

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



ImportError: Could not import settings 'flyp.settings' (Is it on sys.path? Does it have syntax errors?): No module named flyp.settings

2010-11-01 Thread sami nathan
MY system path is
D:\Python25\Lib\site-packages\django\bin\admin.py;D:\Python25;D:\Program
Files\Subversion\bin:D:\Python25\Lib\site-packages\django;D:\Python25\Lib\site-packages\django\bin\flyp;D:\Python25\Tools;D:\Python25\Lib\site-packages\django\bin\flyp\settings;

my LOCATION looks like this

   SetHandler python-program
   PythonHandler django.core.handlers.modpython
   SetEnv DJANGO_SETTINGS_MODULE flyp.settings
   PythonOption django.root /flyp
   PythonDebug On
   PythonPath 
"['D:/Python25','D:/Python25/Lib/site-packages/django/bin/flyp','D:/Python25/Lib/site-packages/django/bin/flyp/settings',]
+ sys.path"
  
i AM GETTING FOLLOWING ERROR

MOD_PYTHON ERROR

ProcessId:  3908
Interpreter:'192.168.1.116'

ServerName: '192.168.1.116'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs'

URI:'/flyp/'
Location:   '/flyp/'
Directory:  None
Filename:   'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/flyp/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
   default=default_handler, arg=req, silent=hlist.silent)

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
   result = _execute_target(config, req, object, arg)

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
   result = object(arg)

 File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 213, in handler
   return ModPythonHandler()(req)

 File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 174, in __call__
   self.load_middleware()

 File "D:\Python25\lib\site-packages\django\core\handlers\base.py",
line 37, in load_middleware
   for middleware_path in settings.MIDDLEWARE_CLASSES:

 File "D:\Python25\lib\site-packages\django\utils\functional.py",
line 276, in __getattr__
   self._setup()

 File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
41, in _setup
   self._wrapped = Settings(settings_module)

 File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
76, in __init__
   raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e))

ImportError: Could not import settings 'flyp.settings' (Is it on
sys.path? Does it have syntax errors?): No module named flyp.settings

AND ALSO GETTING THIS ERROR WHILE CREATING DATABASE
Exception exceptions.AttributeError: '_shutdown' in  ignored

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



Fwd: ImportError: Could not import settings 'flyp.settings' (Is it on sys.path? Does it have syntax errors?): No module named flyp.settings

2010-11-01 Thread sami nathan
-- Forwarded message --
From: sami nathan 
Date: Mon, Nov 1, 2010 at 6:42 PM
Subject: ImportError: Could not import settings 'flyp.settings' (Is it
on sys.path? Does it have syntax errors?): No module named
flyp.settings
To: django-users@googlegroups.com


MY system path is
D:\Python25\Lib\site-packages\django\bin\admin.py;D:\Python25;D:\Program
Files\Subversion\bin:D:\Python25\Lib\site-packages\django;D:\Python25\Lib\site-packages\django\bin\flyp;D:\Python25\Tools;D:\Python25\Lib\site-packages\django\bin\flyp\settings;

my LOCATION looks like this

   SetHandler python-program
   PythonHandler django.core.handlers.modpython
   SetEnv DJANGO_SETTINGS_MODULE flyp.settings
   PythonOption django.root /flyp
   PythonDebug On
   PythonPath 
"['D:/Python25','D:/Python25/Lib/site-packages/django/bin/flyp','D:/Python25/Lib/site-packages/django/bin/flyp/settings',]
+ sys.path"
  
i AM GETTING FOLLOWING ERROR

MOD_PYTHON ERROR

ProcessId:      3908
Interpreter:    '192.168.1.116'

ServerName:     '192.168.1.116'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs'

URI:            '/flyp/'
Location:       '/flyp/'
Directory:      None
Filename:       'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/flyp/'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'django.core.handlers.modpython'

Traceback (most recent call last):

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
   default=default_handler, arg=req, silent=hlist.silent)

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
   result = _execute_target(config, req, object, arg)

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
   result = object(arg)

 File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 213, in handler
   return ModPythonHandler()(req)

 File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 174, in __call__
   self.load_middleware()

 File "D:\Python25\lib\site-packages\django\core\handlers\base.py",
line 37, in load_middleware
   for middleware_path in settings.MIDDLEWARE_CLASSES:

 File "D:\Python25\lib\site-packages\django\utils\functional.py",
line 276, in __getattr__
   self._setup()

 File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
41, in _setup
   self._wrapped = Settings(settings_module)

 File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
76, in __init__
   raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e))

ImportError: Could not import settings 'flyp.settings' (Is it on
sys.path? Does it have syntax errors?): No module named flyp.settings

AND ALSO GETTING THIS ERROR WHILE CREATING DATABASE
Exception exceptions.AttributeError: '_shutdown' in  ignored

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



ImportError: Could not import settings 'flyp.settings' (Is it on sys.path? Does it have syntax errors?): No module named flyp.settings

2010-11-01 Thread sami nathan
MY system path is
D:\Python25\Lib\site-packages\django\bin\admin.py;D:\Python25;D:\Program
Files\Subversion\bin:D:\Python25\Lib\site-packages\django;D:\Python25\Lib\site-packages\django\bin\flyp;D:\Python25\Tools;D:\Python25\Lib\site-packages\django\bin\flyp\settings;

my LOCATION looks like this

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE flyp.settings
PythonOption django.root /flyp
PythonDebug On
PythonPath 
"['D:/Python25','D:/Python25/Lib/site-packages/django/bin/flyp','D:/Python25/Lib/site-packages/django/bin/flyp/settings',]
+ sys.path"
   
i AM GETTING FOLLOWING ERROR

MOD_PYTHON ERROR

ProcessId:  3908
Interpreter:'192.168.1.116'

ServerName: '192.168.1.116'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs'

URI:'/flyp/'
Location:   '/flyp/'
Directory:  None
Filename:   'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/flyp/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
result = object(arg)

  File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 213, in handler
return ModPythonHandler()(req)

  File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 174, in __call__
self.load_middleware()

  File "D:\Python25\lib\site-packages\django\core\handlers\base.py",
line 37, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "D:\Python25\lib\site-packages\django\utils\functional.py",
line 276, in __getattr__
self._setup()

  File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
41, in _setup
self._wrapped = Settings(settings_module)

  File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
76, in __init__
raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e))

ImportError: Could not import settings 'flyp.settings' (Is it on
sys.path? Does it have syntax errors?): No module named flyp.settings

AND ALSO GETTING THIS ERROR WHILE CREATING DATABASE
Exception exceptions.AttributeError: '_shutdown' in  ignored

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



Re: cannot setup database

2010-11-01 Thread sami nathan
My setting file looks like this
# Django settings for flyp project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@domain.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME':
'D:\Python25\Lib\site-packages\django\bin\flyp\sqlite3.db',
  # Or path to database file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com";, "http://example.com/media/";
MEDIA_URL = ''

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/static/"
STATICFILES_ROOT = ''

# URL that handles the static files served from STATICFILES_ROOT.
# Example: "http://static.lawrence.com/";, "http://example.com/static/";
STATICFILES_URL = '/static/'

# URL prefix for admin media -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/";, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# A list of locations of additional static files
STATICFILES_DIRS = ()

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'ky7bf$^vv$$-#vjx4ha%j&e!d#$g=7w2...@i-^9g#ai9fa8*^'

# 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',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'flyp.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

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

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request':{
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}

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

cannot setup database

2010-10-31 Thread sami nathan
When i run the command python manage.py syncdb i got the follwing error





self.connection = Database.connect(**kwargs)
sqlite3.OperationalError: unable to open database file
Exception exceptions.AttributeError: '_shutdown' in  ignoredDATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql',



MY DB SETUP LOOKS LIKE THIS
   'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql',

'sqlite3' or 'oracle'.
'NAME':
'D:\Python25\Lib\site-packages\django\bin\flyp\sqlite3',
   # Or

path to database file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}

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



can't open file 'django-admin.py': [Errno 2] No such file or directory'.

2010-10-29 Thread sami nathan
Whenever I try to execute a python script that is located in the
/usr/local/bin, python gives me the error 'python: can't open file
'django-admin.py': [Errno 2] No such file or directory'.

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



'str' object has no attribute 'resolve' Exception Location: C:\Python25\Lib\site-packages\django\core\urlresolvers.py in resolve,

2010-10-28 Thread sami nathan
-- Forwarded message --
From: sami nathan 
Date: Thu, Oct 28, 2010 at 3:41 PM
Subject: ATTRIBUTE ERROR
To: django-users@googlegroups.com


My occured Error is

Exception Value:

'str' object has no attribute 'resolve'

Exception Location:
       C:\Python25\Lib\site-packages\django\core\urlresolvers.py in resolve,
line 217
~
MY URLS.PY LOOKS LIKE THIS
from django.conf.urls.defaults import *
from flip.view import current_datetime

urlpatterns = ('',
   # Example:

      (r"^wap/di/sub",current_datetime)

)
   # Uncomment the admin/doc line below to enable admin documentation:
   # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
   # Uncomment the next line to enable the admin:
   # (r'^admin/', include(admin.site.urls))
My view .py Looks like this
from django.http import *
import urllib

def current_datetime(request):
   word = request.GET['word']
   message = 
urllib.urlopen('http://m.broov.com/wap/di/sub?word='+word+'&type=00submit=Submit',)
   return HttpResponse (message)

Please help me i dont na what happens it was running succesfully but
noow its not

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



ATTRIBUTE ERROR

2010-10-28 Thread sami nathan
My occured Error is

Exception Value:

'str' object has no attribute 'resolve'

Exception Location:
C:\Python25\Lib\site-packages\django\core\urlresolvers.py in resolve,
line 217
~
MY URLS.PY LOOKS LIKE THIS
from django.conf.urls.defaults import *
from flip.view import current_datetime

urlpatterns = ('',
# Example:

   (r"^wap/di/sub",current_datetime)

)
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls))
My view .py Looks like this
from django.http import *
import urllib

def current_datetime(request):
word = request.GET['word']
message = 
urllib.urlopen('http://m.broov.com/wap/di/sub?word='+word+'&type=00submit=Submit',)
return HttpResponse (message)

Please help me i dont na what happens it was running succesfully but
noow its not

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



django erest interfac

2010-10-27 Thread sami nathan
hi for django restfull interface i am using the link given below is it
correct i am experiencing error in that steps
http://code.google.com/p/django-restful-model-views/ please visit this
and tell me

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



Re: interface django and rest

2010-10-27 Thread sami nathan
But is telling about piston is i am very beginner of django i want to
inerface django and RESTFULL service and i am also blinking with what
to do with my wsdl file Please help by THANKS

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



interface django and rest

2010-10-27 Thread sami nathan
Please Suggest me an tutorial for interfacing django and  restfuli thanks

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



Re: how can i wsdl file in my django

2010-10-25 Thread sami nathan
I think following is opt ans for my question Mr Brian Bouterse




No matter the tools you have, it's hard to make a WSDL for a RESTful
service. WSDL 1.1, after all, was specifically designed to describe
services built using SOAP. In response, the Web Application
Development Language (WADL) was created to easily describe RESTful
services. But WSDL 2.0 is more compatible with both SOAP and REST and,
with its W3C recommendation, competes stiffly with WADL for popularity
among developers.

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



Re: how can i wsdl file in my django

2010-10-25 Thread sami nathan
Can i use RESTfull insted of SOAP service

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



how can i wsdl file in my django

2010-10-23 Thread sami nathan
After completing my project i need to use wsdl file for web service
how could i use it any sugesstions

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



Re: Executing queries across multiple models

2010-10-13 Thread nathan
Thanks. Worked perfectly.

I never thought to do:

for person in Person.objects.all():

--
Nathan

On Oct 13, 4:37 am, Kenneth Gonsalves  wrote:
> On Tue, 2010-10-12 at 20:39 -0700, nathan wrote:
> > I have three Models:
>
> > Person:
> >     name = models.CharField(max_length=20)
>
> > Item:
> >     name = models.CharField(max_length=20)
>
> > Collection:
> >     owner = models.ForeignKey(Person)
> >     items = models.ManyToManyField(Item)
>
> > Where each Person has a Collection consisting of several Items.
>
> > What I want to do is, on a single page display the contents of the
> > database like such:
>
> > Person 1
> >     Item 1
> >     Item 2
>
> > Person 2
> >     Item 1
>
> > etc..
>
> > I have absolutely no idea how to create the queries in django to do
> > this. I know how to do it with raw sql, just not the best way to do it
> > with django. Or how to format the queries and pass them to the
> > template. Any suggestions would be most appreciated.
>
> for person in Person.objects.all():
>    print person
>    for collection in person.collection_set.all():
>       for itm in collection.items.all():
>          print itm
>
> --
> regards
> Kenneth Gonsalves

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



Executing queries across multiple models

2010-10-13 Thread nathan
I have three Models:

Person:
name = models.CharField(max_length=20)

Item:
name = models.CharField(max_length=20)

Collection:
owner = models.ForeignKey(Person)
items = models.ManyToManyField(Item)

Where each Person has a Collection consisting of several Items.

What I want to do is, on a single page display the contents of the
database like such:

Person 1
Item 1
Item 2

Person 2
Item 1

etc..

I have absolutely no idea how to create the queries in django to do
this. I know how to do it with raw sql, just not the best way to do it
with django. Or how to format the queries and pass them to the
template. Any suggestions would be most appreciated.

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



Re: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread sami nathan
Hello sir,
I need to display the reult of
  "http://m.broov.com/wap/di/sub?word=dog&type=00&submit=Submit";
in my url which is
http://localhost/flip/wap/di/sub?word=dog&type=00&submit=Submit
My view looks like this
from django.http import *
from django.template import loader, Context
from django.shortcuts import render_to_response

def current_datetime(request):
  word = request.GET['word']

url=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+"type=00submit=Submit')
  return (url)


   i want response from this site to be displayed not url of the site
i want to only return the response from this site but i am getting oly
url of this site displayed

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



Re: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread sami nathan
Hello sir,
I need to display the reult of
   "http://m.broov.com/wap/di/sub?word=dog&type=00&submit=Submit";
in my url which is
http://localhost/flip/wap/di/sub?word=dog&type=00&submit=Submit
My view looks like this
from django.http import *
from django.template import loader, Context
from django.shortcuts import render_to_response

def current_datetime(request):
   word = request.GET['word']

url=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+"type=00submit=Submit')
   return (url)


i want response from this site to be displayed not url of the site
i want to only return the response from this site but i am getting oly
url of this site displayed

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



Fwd: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread sami nathan
-- Forwarded message --
From: sami nathan 
Date: Tue, Oct 12, 2010 at 3:37 PM
Subject: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL
To: django-users@googlegroups.com


 i want to send my req from my url that
is"http://localhost/flip/wap/di/sub?word=formula&type=00&submit=Submit";
that i want to send only the word "formula" to the url
"http://m.broov.com/wap/di/sub?word=fomula&type=00&submit=Submit"and i
want to get response from the same url and display in my page
my view looks like this

from django.http import *
from django.template import loader, Context

def current_datetime(request):
  word = request.GET['word']
  
message=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+'&submit=Submit')
  return HttpResponse(message)

MY url looks like this

from django.conf.urls.defaults import *
from flip.view import current_datetime




urlpatterns = patterns('',
   :
      (r"^wap/di/sub",current_datetime)

I AM GETTING RESPONSE HAS THE  URL  IN MY DISPLAY 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread sami nathan
 i want to send my req from my url that
is"http://localhost/flip/wap/di/sub?word=formula&type=00&submit=Submit";
that i want to send only the word "formula" to the url
"http://m.broov.com/wap/di/sub?word=fomula&type=00&submit=Submit"and i
want to get response from the same url and display in my page
my view looks like this

from django.http import *
from django.template import loader, Context

def current_datetime(request):
   word = request.GET['word']
   
message=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+'&submit=Submit')
   return HttpResponse(message)

MY url looks like this

from django.conf.urls.defaults import *
from flip.view import current_datetime




urlpatterns = patterns('',
:
   (r"^wap/di/sub",current_datetime)

I AM GETTING RESPONSE HAS THE SAME URL  IN MY DISPLAY 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



  1   2   3   >