Django external access [Windows]

2010-06-05 Thread John Yeukhon Wong
For my home purpose, currently I am running Windows XP. I have everything ready. Django, Python are all good. If I let the runserver (I am using the django-development server) to be 127.0.0.1:8000 or 192.168.1.101:8000 they all worked. Let say abc.no-ip.org is a FREE DNS service I use to access

Re: Django external access [Windows]

2010-06-05 Thread John Yeukhon Wong
of > > accessing your dev server from elsewhere anyway, because you can't see > > the debug messages. > > > On 6 June 2010 10:32, John Yeukhon Wong wrote: > >> For my home purpose, currently I am running Windows XP. > > >> I have everything ready. D

Re: Django external access [Windows]

2010-06-06 Thread John Yeukhon Wong
, 1:19 am, Sam Lai wrote: > Does it work from another machine on the same local network? > > This is definitely possible though; I've done it before. > > On 6 June 2010 14:35, John Yeukhon Wong wrote: > > > I just disabled the FW, but no luck with any trials. > >

mod_wsgi+Apache+Postregsql on Windows

2010-08-13 Thread John Yeukhon Wong
Hi, I know most of you work on Linux, but I do need this to be done on Windows for a very personal reason. I mainly followed this tutorial here, except that I use mod_wsgi over mod_python. http://wiki.thinkhole.org/howto:django_on_windows I had my python 2.7, apache, mod_wsgi and postreg all inst

Re: mod_wsgi+Apache+Postregsql on Windows

2010-08-13 Thread John Yeukhon Wong
rder deny,allow Allow from all 3. I try to access to localhost/hello.wsgi but it's still giving me the same blue django default page Thank you for the help On Aug 13, 10:01 pm, Graham Dumpleton wrote: > On Aug 14, 11:26 am, John Yeukhon Wong wrote: > > > > >

Re: mod_wsgi+Apache+Postregsql on Windows

2010-08-13 Thread John Yeukhon Wong
According to this post http://www.rkblog.rk.edu.pl/w/p/mod_wsgi/ I used the similar approach, and had localhost/hello.py and worked. But what about the WSCI way that you showed us in the video? Thank you. -- You received this message because you are subscribed to the Google Groups "Django use

Re: mod_wsgi+Apache+Postregsql on Windows

2010-08-13 Thread John Yeukhon Wong
Hi, Graham I looked at the error log and I fully understood the problem. I spent an hour trying different ways to understand the whole thing. Here is the result. f:/public/testproject/apache/django.wsgi //code begins here import os, sys sys.path.append("f:/public") os.environ['DJANGO_SETTINGS_

which python does django takes (two python exists)

2010-08-16 Thread John Yeukhon Wong
I am running Debian Lenny, and I have 2.5.25 and 2.7 co-exists Which one would I get for django? Notice the last response from this link http://stackoverflow.com/questions/142764/how-do-i-upgrade-python-2-5-2-to-python-2-6rc2-on-ubuntu-linux-8-04 This is the method that I used... -- You receive

mod_wsgi and first django app

2010-08-16 Thread John Yeukhon Wong
I have the book "The definitive Guide to DJango: Web Development Done Right". Both editions use mod_python, and not mod_wsgi. I have the setup correctly. The first program was display the current datetime views.py from django.http import HttpResponse import datetime def current_datetime(reques

Re: mod_wsgi and first django app

2010-08-16 Thread John Yeukhon Wong
Yeukhon Wong wrote: > I have the book "The definitive Guide to DJango: Web Development Done > Right". > Both editions use mod_python, and not mod_wsgi. > > I have the setup correctly. > > The first program was display the current datetime > > views.py > > fr

check email duplication at registration

2010-08-21 Thread John Yeukhon Wong
I don't think this code is working properly from django import forms from django.contrib.auth.models import User def clean_email(self): email = self.cleaned_data['email'] try: User.objects.get(email=email) except User.DoesNotExist: return email raise forms.Validati

Re: check email duplication at registration

2010-08-21 Thread John Yeukhon Wong
tExist: return email raise forms.ValidationError('This email address has been registered with an existing user.') /// code ends On Aug 21, 10:05 pm, Steve Holden wrote: > On 8/21/2010 7:23 PM, John Yeukhon Wong wrote:> I don't think this code is > w

Re: check email duplication at registration

2010-08-22 Thread John Yeukhon Wong
Hi, thank you for pointing out the problem! Solved! Thank you!! -- 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+unsub

help with understanding tag cloud code

2010-08-22 Thread John Yeukhon Wong
Hi, I am confused with this piece of code. This is a code responsible for building a tag cloud. It lives in the views.py The part I don't understand is # Calculate tag, min and max counts. min_count = max_count = tags[0].bookmarks.count() I never had used this 3 assignments in Python bef

the structure of a registration app

2010-08-23 Thread John Yeukhon Wong
I want to understand something... Let say I want to do a low-level registration handling myself, using the User class that comes with Django. I started an app called accounts in my project So what should I put in model? Some examples would create an additional file called forms.py to put the regi

multiple views function in a single URL specification

2010-10-17 Thread John Yeukhon Wong
I asked this somewhere else but it seems like the responder hasn't reply the latest comment I made. http://stackoverflow.com/questions/3951758/how-do-you-iterate-over-a-list-in-django/3951775#3951775 Nevertheless, I think I should be welcome to make one here. Let's keep thing short. Say I have a

Re: multiple views function in a single URL specification

2010-10-17 Thread John Yeukhon Wong
I think for the link view function, I need to do something like this instead. Sorry. [--code--] def link(request): c = Context() c['title'] = ['Home Page', 'Current Time', '10 hours later'] return render_to_response('time.html', c)

multiple views function in a single URL specification

2010-10-17 Thread John Yeukhon Wong
I asked this somewhere else but it seems like the responder hasn't reply the latest comment I made. http://stackoverflow.com/questions/3951758/how-do-you-iterate-over-a-... Nevertheless, I think I should be welcome to make one here. Let's keep thing short. Say I have a very simple list to iterat

too many options error when launching sqlite3 dbshell

2010-10-22 Thread John Yeukhon Wong
I have django 1.2.3.0 Final In my setting, I have 'sqlite3' filled for the DATABASE_ENGINE. I am able to work with the sqlite3 until I am told that I need to access python manage.py dbshell At first I got the error "sqlite3 is not recongized" Then I read threads and I found that this can be s

Re: too many options error when launching sqlite3 dbshell

2010-10-23 Thread John Yeukhon Wong
Problem solved. SQLite will chop the path of the sqlite.db... so instead moved to "C:\\sqlite.db" will solve the problem. On Oct 22, 9:47 pm, John Yeukhon Wong wrote: > I have django 1.2.3.0 Final > > In my setting, I have 'sqlite3' filled for the DATABASE_ENGINE.

'str' object not callable

2010-10-26 Thread John Yeukhon Wong
This is part of my views [[[code]]] from mysite.views def site_root(request): return HttpResponse("This is the site root") def hello(request): return HttpResponse("Hello World") [[endcode]] My URLConf [[code]] from django.conf.urls.defaults import * urlpatterns = patterns('mysite.view

site_media and media

2012-02-08 Thread John Yeukhon Wong
I am working on someone's legacy code. We do testings on virtual machine (like virtulabox). The virtual machine image contains a working version of our project, and under the directory we have this: project - media/ - site_media - static -- You received this message because you are su

Can anyone please explain the following settings?

2012-02-08 Thread John Yeukhon Wong
# Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = os.path.join(PROJECT_ROOT, "site_media", "media") # 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 ca

Should I always provide a return value when writing my test using mock library?

2012-04-10 Thread John Yeukhon Wong
I am Cc this to testing-in-python mailing list. Hope this makes sense. Suppose I have a function called "render_reverse" which takes two arguments: function name, and args list, and it returns "reverse(f, *args)" If I called render_reverse('happy_birthday', {'args': [username]}), I would get th

Is it a good practice to delegate views based on GET / POST?

2012-04-10 Thread John Yeukhon Wong
3/4 down the page http://www.djangobook.com/en/2.0/chapter08/ urlpatterns = patterns('', # ... (r'^somepage/$', views.method_splitter, {'GET': views.some_page_get, 'POST': views.some_page_post}), # ... ) Is this a good practice at all? If I use the method splitter, my urls will look ugly. Or s

Re: Is it a good practice to delegate views based on GET / POST?

2012-04-11 Thread John Yeukhon Wong
protect your WSGI application from the outside world. If you don't > have access to the server's configuration, well, then I'm sure the cloud > service you deployed to is "safe enough". > > On Tuesday, 10 April 2012 18:21:15 UTC-5, John Yeukhon Wong wrote

Re: Any tool to validate django templates?

2012-04-16 Thread John Yeukhon Wong
Would this help? http://stackoverflow.com/questions/3086637/how-should-i-validate-html-in-django-templates-during-the-development-process I quite like the not-accepted-as-answer. Just go through your urls. Essentially, you have two types of possible template errors: 1. human errors (missing a cl

Re: Use Django to implement my GUI!

2012-05-13 Thread John Yeukhon Wong
Maybe pyjs? Do the GUI part using Python (which renders into javascript), and you can connect it using Django as your backend. On Sunday, May 13, 2012 6:14:36 AM UTC-4, Eugene NGONTANG wrote: > > Hi! > > I'm a python developper, but new in django. > > I'm devolopping a multi clients-server appl

Adding a custom validation to Django's auth_user in admin

2012-07-08 Thread John Yeukhon Wong
Django has list_editable. I need to edit is_active flag. class MyUserAdminForm(ModelForm): class Meta: model = User def clean_is_active(self): # do something that validates your data print ' I am here... ' print self.cleaned_data print self cla

Re: how to use HTTPS with django

2012-07-08 Thread John Yeukhon Wong
I agree, but I think at the web server level is much better. Middlewares can break if Django core changes a lot, and since they are third-party hack code, so unless you are confident how to maintain it yourself, don't use them. Apache, Nginx configurations are widely used so they are easier to

Re: Web service development

2012-07-08 Thread John Yeukhon Wong
You run the development server right out of the box such as python manage.py runserver But for real deployment you don't use the development servers. It doesn't support multiple requests. It will break. It's a toy, basically. Watch some youtube videos on getting started with Django. Then look at

Re: New Project 403 Forbidden Error

2012-10-02 Thread John Yeukhon Wong
Just a quick question. Is is possible for you to manually setup this without bothering cpanel? I mean u should have access to CentOS (ssh into it) right? Then the setup should be very easy if you have that. I will use Nginx + gunicorn if you really have that option. I want to make sure you do wi

Re: what is the best IDE to use for Python / Django

2012-01-21 Thread John Yeukhon Wong
While it has been asked a trillion times already, let me say TRY UT YOURSELF. Sometimes even doing on console such as vim is not bad. However if you are working on a huge project an IDE can help you. Pycharm is very good. The problem is still very new but its development. Maturity is outstanding.

[beginner] extra_context in generic views

2011-01-19 Thread John Yeukhon Wong
http://docs.djangoproject.com/en/dev/topics/generic-views/#adding-extra-context I am confused by the model scenario. "For example, think of showing a list of all the books on each publisher detail page. The object_detail generic view provides the publisher to the context, but it seems there's no w

label when customize django form

2011-01-24 Thread John Yeukhon Wong
In forms,py, we can simple do this e_mail = forms.EmailField(label='Your e-mail address') this will work and be use if we use {{ form.as_table}} for example. But if we instead use our own customization, because it's too restricted to use the auto form render, when it comes to labels, we have to

how to get the time from date-based generic views

2011-02-25 Thread John Yeukhon Wong
Suppose we have a django page using django.views.generic.date_based.object_detail (or even archive_index.. actually doesn't really matter...) In the model class I saved the datetime.datetime.now which suppose to include the day, month, year, and time. But I have no idea how to access the time par

Re: how to get the time from date-based generic views

2011-02-25 Thread John Yeukhon Wong
OHHH this is really impressive. I didn't really think of that. Thanks! Now I have another concept loaded under my belt. Hhaha THank! On Feb 26, 12:18 am, Russell Keith-Magee wrote: > On Sat, Feb 26, 2011 at 1:09 PM, John Yeukhon Wong > > wrote: > > Suppose we have