running app in backend

2010-12-08 Thread commonzenpython
hey guys, im trying to run a script in the backend of my django
project, i have used django signals to call my script and run it when
foo class is saved, and in the foo class theres a variable that can be
true or false, if its true it calls an infinte loop that runs a
function every x seconds, but since this is an infinite loop, its
keeping the django HTTPRequest active, so the page never finishes
loading, is there a way to bipass this behavior ?

-- 
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: admin view

2010-12-07 Thread commonzenpython
thanks for your reply, iv been reading the documentation, and wrote
the code, but theres one thing im having trouble with, i included the
signal connection in my models.py, and passed the model that was there
to the handler function so that it can be tied to that specific model,
like so

class foo(models.Model):
#model code here

def handler(sender=foo,  **kwargs):
#code to be executed when model foo saved

 post_save.connect(handler)

now,  in the code to be executed i instantiate a class that imports
the model foo, but django wont import 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.



admin view

2010-12-06 Thread commonzenpython
hey guys, im trying to get a script to  run, like a view after a user
in the admin interface checks a box and saves the object, is there any
way of accomplishing this without having to rewrite the add_view, and
edit_view ?

-- 
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.



Multiple django projects

2010-09-02 Thread commonzenpython
hey, guys
is it possible to have multiple django projects in one 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: fetching values from model

2010-09-01 Thread commonzenpython
no :)

-- 
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: Error with Apache and mod_wsgi

2010-08-05 Thread commonzenpython
please check the apache error logs, and post the info so i can be of
more assistance to 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django sites framework

2010-08-03 Thread commonzenpython
hey guys, i have been reading about django sites, but i still dont
understand how to implement it to manage multiple sites using the
admin, i have two domains, ashtangayogavideo.com, and
abilityexplosion.org, im using mod_wsgi in a django project inside
ashtangayogavideo.com, how can i link a model to from
ashtangayogavideo.com to display info, in  abilityexplosion.org ?

-- 
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: working with model fields

2010-07-24 Thread commonzenpython
since its by default, ill just use css to contain the box, 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-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.



working with model fields

2010-07-23 Thread commonzenpython
hey guys, im making a form, and im having a problem with the
models.TextField() , when used it displays the text field correctly,
but it allows for the text field to be stretched, is there a way to
set a maximun width and height for 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: forms

2010-07-20 Thread commonzenpython
yes, i did inherit from forms.Form , but no, i dont have a model for
my data , i only have a class in forms.py that displays three
charfields for the user, and i use it throuh my views.py like this :

from django.shortcuts import render_to_response
from ash.forms import VolunteerForm
from django.http import HttpResponseRedirect


def volunteer(request):
if request.method == 'POST':
form = VolunteerForm(request.POST)
if form.is_valid():
fm = form.save()
return HttpResponseRedirect('http://ashtangayogavideo.com/
ash/polls')
else:
form = VolunteerForm()
return render_to_response('contact_form.html', {'form': form})

and this is my forms.py :

from django import forms

class VolunteerForm(forms.Form):
name = forms.CharField()
last = forms.CharField()
company = forms.CharField()

-- 
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: forms

2010-07-20 Thread commonzenpython
VolunteerForm is the name of my form class in forms.py, i put the code
you gave me :

if request.POST:
form = VolunteerForm(request.POST)
if form.is_valid():
fm = form.save()

in my views.py

when i visit the url, i get the form , but when i submit information,
i get a 500 error, and django sends me a message that says
 AttributeError: 'VolunteerForm' object has no attribute 'save'

-- 
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: Since recently: django_session error

2010-07-20 Thread commonzenpython
i know this might sound kinda dumb, but have you tried syncing the
database ? just in case

-- 
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.



forms

2010-07-20 Thread commonzenpython
hey guys, im trying to make a volunteer form which has several fields,
like name, address, and other types of information about the
volunteer, and i was wondering how i can make a form  that saves the
user input in the database (MySQL) , so far i now i have to create a
forms.py file in the same directory where my views.py is, and then use
it through views.py, but  dont know how to save it to the database, so
that it can be retrieved later on

-- 
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: django template variables

2010-07-10 Thread commonzenpython
alright, thanks a lot Syed :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-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: django template variables

2010-07-10 Thread commonzenpython
thanks, unfortunately i keep getting a 404, the templates name is
2col.html, its inside ash/templates, the url i have is (r'^paragraph/
$', 'show_para'),   and the views is
from django.http import HttpResponse
from django.shortcuts import render_to_response

def show_para(request):
para = "I love this project"
variables = RequestContext(request,{ 'paragraph': para})
return render_to_response('2col.html',variables)

even if it works i was wondering if i would have to create a new
function for every variable,
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.



django template variables

2010-07-10 Thread commonzenpython
hey guys, im trying to create a template that uses variables like
{{ paragraph }} , but i cannot find how to get django to render
the paragraph into the variable, i know i have to create a .py file
that uses django's render class to render the paragraph but how can i
connect the html file to the .py file so that it renders 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: Serving django admin files using mod_python

2010-06-24 Thread commonzenpython
 im done using mod_python , i have switched to mod_wsgi completely,
thanks guys for all your help

-- 
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: Serving django admin files using mod_python

2010-06-24 Thread commonzenpython
im new to mod_python, so could you please tell me how to set ash/media
to serve statically with apache

-- 
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.



Serving django admin files using mod_python

2010-06-24 Thread commonzenpython
i have been playing with django using mod_python, so i activated the
admin for my application and instead of the pretty looking page, i
get :

Django administration

Welcome, ashtanga. Change password / Log out
Site administration

Auth
Groups  Add Change
Users   Add Change
Sites
Sites   Add Change
Recent Actions

My Actions

None available

i know this has something to do with the static files, and iv read
several posts on it, but i cant find a solution for mod_python, this
is my httpd.conf for mod_python:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE ash.settings
SetEnv PYTHON_EGG_CACHE /tmp
PythonOption django.root /ash
PythonDebug On
   PythonPath "['/home/ashtanga/public_html/', '/home/ashtanga/
public_html/ash'] + sys.path"


my project path is /home/ashtanga/public_html/ash

-- 
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: Deploying Django with mod_wsgi

2010-06-24 Thread commonzenpython
it would give me the same error, but with a different directory,
thanks a lot guys, i have solved this by putting SetEnv
PYTHON_EGG_CACHE /tmp as follows

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE ash.settings
SetEnv PYTHON_EGG_CACHE /tmp
PythonOption django.root /ash
PythonDebug On
   PythonPath "['/home/ashtanga/public_html/', '/home/ashtanga/
public_html/ash'] + sys.path"


i officially have django running now

-- 
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: Deploying Django with mod_wsgi

2010-06-24 Thread commonzenpython
i have ran into the same error i get using mod_wsgi, which is :

ExtractionError at /
Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the
Python egg
cache:

  [Errno 13] Permission denied: '/.python-eggs'

The Python egg cache directory is currently set to:

  /.python-eggs

Perhaps your account does not have write access to this directory?
You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible 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.



Re: Deploying Django with mod_wsgi

2010-06-22 Thread commonzenpython
it turns out i have the __init__.py , so i changed the path as you
suggested but now i get this error :

MOD_PYTHON ERROR

ProcessId:  12182
Interpreter:'ashtangayogavideo.com'

ServerName: 'ashtangayogavideo.com'
DocumentRoot:   '/home/ashtanga/public_html'

URI:'/ash/'
Location:   '/ash/'
Directory:  None
Filename:   '/home/ashtanga/public_html/ash/'
PathInfo:   ''

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

Traceback (most recent call last):

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1128, in _execute_target
result = object(arg)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 228, in handler
return ModPythonHandler()(req)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 191, in __call__
self.load_middleware()

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
base.py", line 33, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "/usr/local/lib/python2.4/site-packages/django/utils/
functional.py", line 276, in __getattr__
self._setup()

  File "/usr/local/lib/python2.4/site-packages/django/conf/
__init__.py", line 40, in _setup
self._wrapped = Settings(settings_module)

  File "/usr/local/lib/python2.4/site-packages/django/conf/
__init__.py", line 75, 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 'settings' (Is it on sys.path?
Does it have syntax errors?): No module named settings

-- 
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: Deploying Django with mod_wsgi

2010-06-22 Thread commonzenpython
thanks, but what should be inside the __init__.py file ?

-- 
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: Deploying Django with mod_wsgi

2010-06-22 Thread commonzenpython
thanks, i have read your post and i am beginning to understand this
better, i am also trying mod_python as an alternative my project path
is the same /home/ashtanga/public_html/ash
insdie the ash is my Django project and iside it i have my settings.py
and urls.py, i have added the following script to the httpd.conf
file :


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
PythonOption django.root /ash
PythonDebug On
PythonPath "['/home/ashtanga/public_html/ash'] + sys.path"


but i keep getting this error :


MOD_PYTHON ERROR

ProcessId:  11275
Interpreter:'ashtangayogavideo.com'

ServerName: 'ashtangayogavideo.com'
DocumentRoot:   '/home/ashtanga/public_html'

URI:'/ash/'
Location:   '/ash/'
Directory:  None
Filename:   '/home/ashtanga/public_html/ash/'
PathInfo:   ''

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

Traceback (most recent call last):

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1128, in _execute_target
result = object(arg)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 228, in handler
return ModPythonHandler()(req)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 201, in __call__
response = self.get_response(request)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
base.py", line 142, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
base.py", line 177, in handle_uncaught_exception
if resolver.urlconf_module is None:

  File "/usr/local/lib/python2.4/site-packages/django/core/
urlresolvers.py", line 238, in _get_urlconf_module
self._urlconf_module = import_module(self.urlconf_name)

  File "/usr/local/lib/python2.4/site-packages/django/utils/
importlib.py", line 35, in import_module
__import__(name)

ImportError: No module named ash.urls

i have read several posts on the same subject but none of the fixes
provided in them solve the 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: Deploying Django with mod_wsgi

2010-06-20 Thread commonzenpython
Graham thanks for all your help, and patience,  i will read the the
information in the link you provided, this is the exact configuration
i added to the httpd.conf file :


LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / /home/ashtanga/public_html/ash/apache/django.wsgi

the path to my Django project is /home/ashtanga/public_html/ash

This is my django.wsgi:

import os
import sys
sys.path.append('/home/ashtanga/public_html/ash') # again i changed
the actual adress for
security purposes but the path leads to my project called ash
os.environ['DJANGO_SETTINGS_MODULE'] = 'ash.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

i will try the quick fix provided by Izantal

-- 
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: Deploying Django with mod_wsgi

2010-06-19 Thread commonzenpython
thanks, i have seen the error logs and it says "could not import
settings "ash.settings" ( is it on sys path ?)"  ash is the name of my
project, also i didnt get a 500 error this time, my website just didnt
load, i added the following configuration to the httpd.conf :
LoadModule wsgi_module modules/mod_wsgi.so

and then i put:

WSGIScriptAlias / /ash/apache/ django.wsgi  #which isn't the actual
things i typed for security purposes but its basically the same since
its a path to my wsgi file

this is whats inside my wsgi file:

import os
import sys
sys.path.append('PATH/ash') # again i changed the actual adress for
security purposes but the path leads to my project called ash
os.environ['DJANGO_SETTINGS_MODULE'] = 'ash.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

-- 
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: Deploying Django with mod_wsgi

2010-06-19 Thread commonzenpython
im sorry, its causing an error 500, but i know its because of an error
in the httpd.conf file, but i dont know what, i have written the sript
WSGIScriptAlias / "/apache/
dj_survey.wsgi" exactly how its supposed to be written but its still
causing the crash, is there anything besides that script that i have
to write so it works

-- 
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.



Deploying Django with mod_wsgi

2010-06-19 Thread commonzenpython
Hey guys, im trying to  deploy django using MySQl, Apache 2, and
mod_wsgi, but i am having lots of difficulties which are causing my
sites to go down, i have loaded the mod_wsgi module in the Apache
httpd.conf file successfully, but every time i try to put this line f
WSGIScriptAlias / "/apache/
dj_survey.wsgi" , in the httpd.conf file, so apache knows where to
find my wsgi file, it causes an error, and therefore makes all my
current websites go offline, all i want to do is be able to run django
on the server and see the Django "YOU DID IT " message or an app i
have created.

-- 
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.