What reason is Django administration

2012-03-08 Thread Stone
Dear users,

I have developed some web pages and I have never used Django
administration?
Is there any control for controlling access of users?

Do you have any examples?

Thank you
Petr

-- 
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: What reason is Django administration

2012-03-09 Thread Stone
OK. Thanks

If I understand right, than I can add users over that Admin interface.
Over function has_change_permissions I can track whether user is
authenticated.

Over that interface is also for logged/authenticated users, right?

Lets say that user will successfully enter login data as user name as
passwd.
afterwards some operations will be allowed.
W/o authentication web page will be only in read only state.
Is this situation suitable for that default Administration page?

Am I right with that?

On 9 bře, 02:02, kenneth gonsalves  wrote:
> On Thu, 2012-03-08 at 12:44 -0800, Stone wrote:
> > I have developed some web pages and I have never used Django
> > administration?
> > Is there any control for controlling access of users?
>
> https://docs.djangoproject.com/en/dev/ref/contrib/admin/
>
> search for has_change_permission
> --
> 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-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.



Problem with Django naming convence

2012-05-10 Thread Stone
Dear user,

I am novice with Django,

I have developed some applications but each time they have the same
URL as in physical path.
like URL: http:/testlab and on file system was /opt/Django/testlab
with view.py etc.

Now I would like to develop application called SSO
where all url.py, view.py will be stored in /srv/www/sso/htdocs2 and
in browser will be called over http:///SSO/
How shall I config settings.py and url.py

My settings.py and their important parts are:
linux-6cic:/srv/www/sso/htdocs2 # cat settings.py
# Django settings for htdocs2 project.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '',  # 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.
}
}


# Absolute filesystem path to the directory that will hold user-
uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = '/srv/www/sso/htdocs2/media'

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash.
# Examples: "http://media.lawrence.com/media/";, "http://example.com/
media/"
MEDIA_URL = ''

ROOT_URLCONF = 'htdocs2.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.
'/srv/www/sso/htdocs2/templates',
)

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

}
linux-6cic:/srv/www/sso/htdocs2 #
linux-6cic:/srv/www/sso/htdocs2 # cat urls.py
from django.conf.urls.defaults import patterns, include, url
from htdocs2.views import index, config_page

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

urlpatterns = patterns('',
(r'^$', index),
(r'^status/$', index),
(r'^config/$', config_page),
)
linux-6cic:/srv/www/sso/htdocs2 #

Is this settings OK?

Thnak you in advance
Petr

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



Visibility images/css from another directories

2012-05-17 Thread Stone
Dear users,

I have a some simple question.
Let's say that my project (dJango) is stored on the file system here:
/opt/appl/htdocs
and media files are stored here:
/opt/appl/htdocs/media/css
/opt/appl/htdocs/media/images

All CSS and images are visible under directory /opt/appl/htdocs w/o
problem.

Another images and css are stored here:
/opt/common/htdocs/media/css
/opt/common/htdocs/media/images

Is there any way how to visible in dJango all CSS and images
from directory /opt/common/htdocs/...?>

Thank you in advance
Petr

-- 
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: Visibility images/css from another directories

2012-05-17 Thread Stone
Sorry,
now I have only the dev one for the moment,
but for real usage I will have apache2-2.2.22

Best reagards
Petr

On 17 kvě, 12:01, Ilian Iliev  wrote:
> Hi,
>
> can you add some more details. Are you using web server or you have only
> the dev one for the moment. If you have web server what is it: Apache,
> NginX etc.?
>
> Best wishes,
> Ilian Iliev
>
> --
> eng. Ilian Iliev
> Web Software Developer
>
> Mobile: +359 88 66 08 400
> Website:http://ilian.i-n-i.org
>
>
>
>
>
>
>
> On Thu, May 17, 2012 at 11:06 AM, Stone  wrote:
> > Dear users,
>
> > I have a some simple question.
> > Let's say that my project (dJango) is stored on the file system here:
> > /opt/appl/htdocs
> > and media files are stored here:
> > /opt/appl/htdocs/media/css
> > /opt/appl/htdocs/media/images
>
> > All CSS and images are visible under directory /opt/appl/htdocs w/o
> > problem.
>
> > Another images and css are stored here:
> > /opt/common/htdocs/media/css
> > /opt/common/htdocs/media/images
>
> > Is there any way how to visible in dJango all CSS and images
> > from directory /opt/common/htdocs/...?>
>
> > Thank you in advance
> > Petr
>
> > --
> > 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.



Re: Visibility images/css from another directories

2012-05-20 Thread Stone
No the URLs are different and storage on the filesystem is also
different.
E.g.
URL /public/js/.. are stored on /opt/public/htdocs
URL /common/js/.. are stored on /opt/common/htdocs
URL appl application /appl/js is stored on /opt/appl/htdocs/media/js/
(Django)
In the development case I can copy that images to the development
server.
This is not a problem.

In the real state the page will be run over mod_python module.
The page written in Django is now only the one and other applications
are written in Perl/CGI/HTML
All web applications are run over standard apache2 2.2.22
On that web server there are two locations were are CSS/JS/images.

The another application written in Perl is located here: /opt/diagnose/
htdocs (URL /diag/..)
And both application as Django as diagnose used the sema web server.

My question is if there is any possibility to share images between /
common/js and /appl/js

Thank you in advance

Petr
On 17 kvě, 14:16, Ilian Iliev  wrote:
> This is a bit more general than a Django issue.
>
> Are both css directories going to be server under the same URL?
> What will happend if both of them contain files with the same name?
> Are you using staticfiles?
>
> And more important why do you have these files out of the project, what is
> the reason
> to load them from separate directory instead from the project?
>
> --
> eng. Ilian Iliev
> Web Software Developer
>
> Mobile: +359 88 66 08 400
> Website:http://ilian.i-n-i.org
>
>
>
>
>
>
>
> On Thu, May 17, 2012 at 1:50 PM, Stone  wrote:
> > Sorry,
> > now I have only the dev one for the moment,
> > but for real usage I will have apache2-2.2.22
>
> > Best reagards
> > Petr
>
> > On 17 kvě, 12:01, Ilian Iliev  wrote:
> > > Hi,
>
> > > can you add some more details. Are you using web server or you have only
> > > the dev one for the moment. If you have web server what is it: Apache,
> > > NginX etc.?
>
> > > Best wishes,
> > > Ilian Iliev
>
> > > --
> > > eng. Ilian Iliev
> > > Web Software Developer
>
> > > Mobile: +359 88 66 08 400
> > > Website:http://ilian.i-n-i.org
>
> > > On Thu, May 17, 2012 at 11:06 AM, Stone  wrote:
> > > > Dear users,
>
> > > > I have a some simple question.
> > > > Let's say that my project (dJango) is stored on the file system here:
> > > > /opt/appl/htdocs
> > > > and media files are stored here:
> > > > /opt/appl/htdocs/media/css
> > > > /opt/appl/htdocs/media/images
>
> > > > All CSS and images are visible under directory /opt/appl/htdocs w/o
> > > > problem.
>
> > > > Another images and css are stored here:
> > > > /opt/common/htdocs/media/css
> > > > /opt/common/htdocs/media/images
>
> > > > Is there any way how to visible in dJango all CSS and images
> > > > from directory /opt/common/htdocs/...?>
>
> > > > Thank you in advance
> > > > Petr
>
> > > > --
> > > > 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.



Authentication over DJango

2012-10-18 Thread Stone
Dear users,

I would like to ask you how to implement feature which is used when you are 
connecting over SSH from one to another machine including
man in the middle attack.

Example:
After pressing on button it will ask me whether fingerprint is correct and 
after pressing on yes password window will be opened
and afterwords I have authentication between one machine to the another one 
over DJango.

Of course I know root password on both machines.

How to do it?

Thanks
Petr

-- 
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/-/-5rqluDKbVEJ.
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: Authentication over DJango

2012-10-18 Thread Stone
Sorry for misundestanding.

I will try to make clean my problem.
I would like to make autentication between two servers over
authorized_keys.

I have program which has to possibilities
1) Console based application - this is already done and working
properly.
2) Web based application - exchanging authorized_keys is not done yet.

ad1) Steps in that case are:
- I am logging to the linux over SSH
- writedown command ssh -l engr  or ssh engr@
- in case that I am logging at first time time I am receiving
fingerprint which I have to confirm over Yes
- now I have to enter password
- I am on another server and uploading authorized_keys

ad2) Steps in that case should be similar
- I am logging to web application over HTTPs
- After pressing on button I should receive fingerprint which I had to
confirm over dialog
- Next window will show me dialog about password
- I am logging on the another server an upload authorized keys.

Is it possible to do that scenario in second case?
How to do the pop window with fingerprint?

Entering password is no problem.

Hopefully now all is clear
best regards
Petr
On Oct 18, 7:43 pm, Nikolas Stevenson-Molnar 
wrote:
> I'm a little unclear about your question, but if I understand correctly,
> you want to prevent man-in-the-middle attacks when logging into a Django
> application? If that's the case, then it's not really a Django issue;
> when you connect to a remote server via SSH, it's the /client /which
> does that verification. In this case, the client is your web browser,
> and the way you prevent such attacks is to use HTTPS and a signed
> certificate from a certificate authority.
>
> _Nik
>
> On 10/18/2012 5:10 AM, Stone wrote:
>
>
>
>
>
>
>
> > Dear users,
>
> > I would like to ask you how to implement feature which is used when
> > you are connecting over SSH from one to another machine including
> > man in the middle attack.
>
> > Example:
> > After pressing on button it will ask me whether fingerprint is correct
> > and after pressing on yes password window will be opened
> > and afterwords I have authentication between one machine to the
> > another one over DJango.
>
> > Of course I know root password on both machines.
>
> > How to do it?
>
> > Thanks
> > Petr
> > --
> > 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/-/-5rqluDKbVEJ.
> > 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.



[Q: Basic] Strange behaviour after pressing on button

2012-10-24 Thread Stone
My Django application is running on real server (apache2-2.2.22).
In urls.py is mentioned:
(r'^configSave/$', configSave),

My HTML is bellow. After pressing on configSave I am receiving HTTP
403 error page.

In view.py is mentioned:
def configSave(request):
configFile={}
if os.path.isfile(SSO_CONF) != False:
f = open(SSO_CONF,"r")
for line in f:
line = line.strip()
if re.search('^#',line) != None:
'''print 'This is the commentary'''
else:
'''print line'''
try:
name, value = line.split('=',2)
configFile[name]=value
print '<%s>%s' % (name, value, 
name)
except ValueError, err:
''' print 'This is empty row'''
configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');

configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
configFile={}
if os.path.isfile(SSO_CONF) != False:
f = open(SSO_CONF,"r")
for line in f:
line = line.strip()
if re.search('^#',line) != None:
'''print 'This is the commentary'''
else:
'''print line'''
try:
name, value = line.split('=',2)
configFile[name]=value
print '<%s>%s' % (name, value, 
name)
except ValueError, err:
''' print 'This is empty row'''
configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');

configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
c = {}
c = Context({
'config':configFile,
'item':2,
})
c.update(csrf(request))
return
render_to_response('config.html',c,context_instance=RequestContext(request))

By the way how to really fast define logging mechanism which can be
use for debugging.

Is this my programmer approach corrector is there any other way how to
react on the pressing of button?


{% extends "index.html" %}
{% block content %}
http://www.w3.org/1999/
xhtml">

  top.helpID="SSO_config";
  $(document).ready(function () {

function sendAjax()
{
$(document).ajaxSend(function(event, xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == (name
+ '=')) {
cookieValue =
decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
function sameOrigin(url) {
var host = document.location.host; // host + port
var protocol = document.location.protocol;
var sr_origin = '//' + host;
var origin = protocol + sr_origin;
// Allow absolute or scheme relative URLs to same origin
return (url == origin || url.slice(0, origin.length + 1)
== origin + '/') ||
(url == sr_origin || url.slice(0, sr_origin.length +
1) == sr_origin + '/') ||
!(/^(\/\/|http:|https:).*/.test(url));
}
function safeMethod(method) {
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
xhr.setRequestHeader("X-CSRFToken",
getCookie('csrftoken'));
}
});
}

$("#saveCfg").click(function(event){

sendAjax();
$.ajax({
type: "POST",
url: "/SSO/configSave/",
dataType: "text",
success: function(data) {
alert(data);
},
error: function(xhr,ajaxOptions,thrownError) {
alert(xhr.status +" "+xhr.statusText);
alert(thrownError);
  

Re: Strange behaviour after pressing on button

2012-10-25 Thread Stone
Over Firefox and Firebug I have received that CSRF Validation failed.
My server is running on apache2-2.2.22 and there are two proxy's
All template file and forms includes csrf_token tag.

On Oct 24, 6:54 pm, Nikolas Stevenson-Molnar 
wrote:
> It's possible that the CSRF token isn't being sent correctly. As a test,
> try adding the @csrf_exempt decorator to your view. If you no longer get
> the 403, then it's a CSRF problem.
>
> _Nik
>
> On 10/24/2012 6:31 AM, Stone wrote:
>
>
>
>
>
>
>
> > My Django application is running on real server (apache2-2.2.22).
> > In urls.py is mentioned:
> >     (r'^configSave/$', configSave),
>
> > My HTML is bellow. After pressing on configSave I am receiving HTTP
> > 403 error page.
>
> > In view.py is mentioned:
> > def configSave(request):
> >    configFile={}
> >    if os.path.isfile(SSO_CONF) != False:
> >            f = open(SSO_CONF,"r")
> >            for line in f:
> >                    line = line.strip()
> >                    if re.search('^#',line) != None:
> >                            '''print 'This is the commentary'''
> >                    else:
> >                            '''print line'''
> >                            try:
> >                                    name, value = line.split('=',2)
> >                                    configFile[name]=value
> >                                    print '<%s>%s' % (name, value, name)
> >                            except ValueError, err:
> >                                    ''' print 'This is empty row'''
> >    configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');
>
> > configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
> >    configFile={}
> >    if os.path.isfile(SSO_CONF) != False:
> >            f = open(SSO_CONF,"r")
> >            for line in f:
> >                    line = line.strip()
> >                    if re.search('^#',line) != None:
> >                            '''print 'This is the commentary'''
> >                    else:
> >                            '''print line'''
> >                            try:
> >                                    name, value = line.split('=',2)
> >                                    configFile[name]=value
> >                                    print '<%s>%s' % (name, value, name)
> >                            except ValueError, err:
> >                                    ''' print 'This is empty row'''
> >    configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');
>
> > configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
> >    c = {}
> >    c = Context({
> >            'config':configFile,
> >            'item':2,
> >    })
> >    c.update(csrf(request))
> >    return
> > render_to_response('config.html',c,context_instance=RequestContext(request))
>
> > By the way how to really fast define logging mechanism which can be
> > use for debugging.
>
> > Is this my programmer approach corrector is there any other way how to
> > react on the pressing of button?
>
> >  >www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > {% extends "index.html" %}
> > {% block content %}
> > http://www.w3.org/1999/
> > xhtml">
> > 
> >   top.helpID="SSO_config";
> >   $(document).ready(function () {
>
> >    function sendAjax()
> >    {
> >        $(document).ajaxSend(function(event, xhr, settings) {
> >            function getCookie(name) {
> >                var cookieValue = null;
> >                if (document.cookie && document.cookie != '') {
> >                    var cookies = document.cookie.split(';');
> >                    for (var i = 0; i < cookies.length; i++) {
> >                        var cookie = jQuery.trim(cookies[i]);
> >                        if (cookie.substring(0, name.length + 1) == (name
> > + '=')) {
> >                            cookieValue =
> > decodeURIComponent(cookie.substring(name.length + 1));
> 

Re: Strange behaviour after pressing on button

2012-10-26 Thread Stone
Hi Nik,

I do not understand. How can I submitted as a actual form parameter?
Are there any examples?

On Oct 25, 5:24 pm, Nikolas Stevenson-Molnar 
wrote:
> It looks like you're submitting your request via AJAX and using the
> X-CSRFToken header. It's very possible that one of your proxies isn't
> forwarding that header correctly. You might try submitting it as an
> actual form parameter instead.
>
> _Nik
>
> On 10/25/2012 6:01 AM, Stone wrote:
>
>
>
>
>
>
>
> > Over Firefox and Firebug I have received that CSRF Validation failed.
> > My server is running on apache2-2.2.22 and there are two proxy's
> > All template file and forms includes csrf_token tag.
>
> > On Oct 24, 6:54 pm, Nikolas Stevenson-Molnar 
> > wrote:
> >> It's possible that the CSRF token isn't being sent correctly. As a test,
> >> try adding the @csrf_exempt decorator to your view. If you no longer get
> >> the 403, then it's a CSRF problem.
>
> >> _Nik
>
> >> On 10/24/2012 6:31 AM, Stone wrote:
>
> >>> My Django application is running on real server (apache2-2.2.22).
> >>> In urls.py is mentioned:
> >>>     (r'^configSave/$', configSave),
> >>> My HTML is bellow. After pressing on configSave I am receiving HTTP
> >>> 403 error page.
> >>> In view.py is mentioned:
> >>> def configSave(request):
> >>>    configFile={}
> >>>    if os.path.isfile(SSO_CONF) != False:
> >>>            f = open(SSO_CONF,"r")
> >>>            for line in f:
> >>>                    line = line.strip()
> >>>                    if re.search('^#',line) != None:
> >>>                            '''print 'This is the commentary'''
> >>>                    else:
> >>>                            '''print line'''
> >>>                            try:
> >>>                                    name, value = line.split('=',2)
> >>>                                    configFile[name]=value
> >>>                                    print '<%s>%s' % (name, value, 
> >>> name)
> >>>                            except ValueError, err:
> >>>                                    ''' print 'This is empty row'''
> >>>    configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');
> >>> configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
> >>>    configFile={}
> >>>    if os.path.isfile(SSO_CONF) != False:
> >>>            f = open(SSO_CONF,"r")
> >>>            for line in f:
> >>>                    line = line.strip()
> >>>                    if re.search('^#',line) != None:
> >>>                            '''print 'This is the commentary'''
> >>>                    else:
> >>>                            '''print line'''
> >>>                            try:
> >>>                                    name, value = line.split('=',2)
> >>>                                    configFile[name]=value
> >>>                                    print '<%s>%s' % (name, value, 
> >>> name)
> >>>                            except ValueError, err:
> >>>                                    ''' print 'This is empty row'''
> >>>    configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');
> >>> configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
> >>>    c = {}
> >>>    c = Context({
> >>>            'config':configFile,
> >>>            'item':2,
> >>>    })
> >>>    c.update(csrf(request))
> >>>    return
> >>> render_to_response('config.html',c,context_instance=RequestContext(request))
> >>> By the way how to really fast define logging mechanism which can be
> >>> use for debugging.
> >>> Is this my programmer approach corrector is there any other way how to
> >>> react on the pressing of button?
> >>>  >>>www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.

Is it possible to run from Django script?

2011-09-20 Thread Stone
Dear users,

I have simple question which regards with running script from view.py.
Part of my view.py looks like:
def updateSystem(request):
print request.POST
id = 20
idgrp = 0
print "ID: %d and IDGRP: %d" % (id, idgrp)
if request.is_ajax():
message = "This is AJAX part"
if request.method == 'POST':
query = request.POST
print query.items()
try:
sysid=51
output = subprocess.Popen(['/home/user/djcode/testlab/
updateSys','-sysid','%d','-id','%d','-idgrp','%d' % (sysid,id,idgrp)],
shell = False, stdou=subprocess.PIPE)
test,err = output.communicate()
print output.returncode
print err
print test
except OSError:
return HttpResponse("Wrong command")
print "CORRECT REQUEST: %s" % query.get('data','sysid=0')
message = "Content-type text/html\n\n"
return HttpResponse(message)
else:
return HttpResponse(status=400)
else:
message = "This is not AJXA"
return HttpResponse(status=400)

Is it possible to do that over subprocess command?

>From the command line script updateSys written in Python as well
should return list of directory.

Thank you
best regards
Petr

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



Fwd: 500 error if django run in scgi mode(fcgi is ok)

2008-08-31 Thread Puzzle Stone
-- Forwarded message --
From: Puzzle Stone <[EMAIL PROTECTED]>
Date: Thu, Aug 28, 2008 at 4:23 PM
Subject: 500 error if django run in scgi mode(fcgi is ok)
To: [EMAIL PROTECTED]


Fcgi and scgi work well in my machine when i use django0.96.2, but scgi
failed when I try to migrate my developing environment from django0.96.2 to
svn version (rev 8643).

I use the shell recommended by the fastcgi.txt to run fastcgi:
exec /usr/bin/env - \
  PYTHONPATH="../python:.." \
  $PROJDIR//manage.py runfcgi protocol=$PROTOCOL socket=$SOCKET
pidfile=$PIDFILE

And i already chmod the .sock file for the permission issue.

It's ok to navigate the web page if i set the PROTOCOL to "fcgi", but there
will be 500 error when i change it to "scgi".
The error messages in /var/log/lighttpd/error.log:
2008-08-28 13:57:42: (mod_fastcgi.c.3281) response not received, request
sent: 920 on socket: unix:/home//workspace/.sock for /.fcgi ,
closing connection
2008-08-28 13:57:43: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps
the fastcgi process died): pid: 0 socket:
unix:/home//workspace/.sock
...

My machine enviroment:
ubuntu: 8.02 en
lighttpd: 1.4.9.19
MySql: 5.0.51a
python: 2.5.2
flup:1.0
django: rev 8643

Are the some defects about scgi in current django or maybe i miss something?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Come on, share your django powered sites with others.//Fwd: A tornado powered site to show any project powered sites(open source)

2010-08-07 Thread Stone Puzzle
Django powered sites list  http://django.poweredsites.org


-- Forwarded message --
From: Felinx Lee 
Date: Tue, Aug 3, 2010 at 2:29 PM
Subject: A tornado powered site to show any project powered sites(open
source)
To: python-torn...@googlegroups.com


 I am very pleased to announce the beta release of
http://poweredsites.org(A tornado powered site to show any project
powered sites)

*What powered sites?*

We are always curious about that when we navigating exciting sites.
PoweredSites is a good site to share with others about a project or service
powered sites, eg. jQuery powered sites
, Torando
powered sites . PoweredSites is also a
good place to show your project's power if you are a project owner.

PoweredSites source code is opened to the community under Apache License V2,
the source code is available at http://www.bitbucket.org/felinx/poweredsites,
it's develop by python and
tornado.
I opened everything except the OpenID API key:), so you can setup a web site
using the code easily.

Currently, twitter,facebook,friendfeed openid login are no well tested
because those web sites are blocked in China. And some of features are still
under developing, eg. re-edit a project or site and wiki for every project.

*I hope that you will enjoy the site and the source code.* *I hope some guys
can join me to make the site better.*

Please don't hesitate to submit your
projectsor submit
web sites  to
http://poweredsites.org/.

And any bug reports are welcome.

For detail information and comments, please visit here.
http://blog.poweredsites.org/entry/poweredsites-beta-online

BTW: You can submit and find tornado powered sites from
http://tornado.poweredsites.org now.

Cheers.

-- 
Felinx Lee

What powered the sites?
http://poweredsites.org

What can change the nature of a man?(Planescape Torment)
http://en.wikipedia.org/wiki/Planescape:_Torment

-- 
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: Come on, share your django powered sites with others.//Fwd: A tornado powered site to show any project powered sites(open source)

2010-08-09 Thread Stone Puzzle
Yes, but this site can show more powered by information.

For example:
A site powered by python/django/jquery/apache/memcached,

the site will be listed at http://django.poweredsites.org and
http://python.poweredsites.org and http://jquery.poweredsites.org etc,

so it's more easy to share powered by information with other projects.


On Mon, Aug 9, 2010 at 12:27 AM, shacker  wrote:

> On Aug 7, 9:50 pm, Stone Puzzle  wrote:
> > Django powered sites list  http://django.poweredsites.org
>
> A much more complete database is at  http://www.djangosites.org/
>
> ./s
>
> --
> 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.
>
>

-- 
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: Come on, share your django powered sites with others.//Fwd: A tornado powered site to show any project powered sites(open source)

2010-08-23 Thread Stone Puzzle
It's official online now after two weeks beta testing.
A bunch of sites already been submitted, come on and enjoy it.

Below list some popular projects' sub-sites:

http://django.poweredsites.org Django poweredsites

http://mongodb.poweredsites.org MongoDB powered sites.

http://jquery.poweredsites.org jQuery powered sites

http://python.poweredsites.org Python powered sites

http://yii.poweredsites.org Yii framework powered sites.

http://flask.poweredsites.org Flask powered sites.

On Mon, Aug 9, 2010 at 4:03 PM, Stone Puzzle  wrote:

> Yes, but this site can show more powered by information.
>
> For example:
> A site powered by python/django/jquery/apache/memcached,
>
> the site will be listed at http://django.poweredsites.org and
> http://python.poweredsites.org and http://jquery.poweredsites.org etc,
>
> so it's more easy to share powered by information with other projects.
>
>
> On Mon, Aug 9, 2010 at 12:27 AM, shacker  wrote:
>
>> On Aug 7, 9:50 pm, Stone Puzzle  wrote:
>> > Django powered sites list  http://django.poweredsites.org
>>
>> A much more complete database is at  http://www.djangosites.org/
>>
>> ./s
>>
>> --
>> 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.
>>
>>
>

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



Best way to access 'request' in pre_save

2010-02-18 Thread Paul Stone
I'm trying to find the best way to update a model using data from the
request object (e.g request.user) before it is saved. One use case for
this is updating an 'updated_by' field on a model.

I've come across http://www.djangosnippets.org/snippets/476/ which
suggests one way of doing this. What do people think of this method?
Are there better/cleaner/more efficient ways of doing this?

-- 
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: Best way to access 'request' in pre_save

2010-02-19 Thread Paul Stone

> Presumably you have a view which is updating this object. The view has
> access to the HttpRequest. Therefore, the easy, simple, clean and
> elegant way is... to have the view set the value of that field. So do
> that and ignore anyone who tells you otherwise --
> magically/secretly/implicitly trying to make things happen or provide
> access to variables is the path of people who prefer to make their own
> jobs harder.

That's fine for one or two models. But what if I want to do this for a
number of models, in every view? What's the best way to do that
without code repetition?

-- 
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: Best way to access 'request' in pre_save

2010-02-19 Thread Paul Stone
> > That's fine for one or two models. But what if I want to do this for a
> > number of models, in every view? What's the best way to do that
> > without code repetition?
>
> Using a ModelForm?
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/

Ok, I think I understand now. ModelForm always has a reference to the
request object. So I can create a subclass of ModelForm (e.g
AuditModelForm) that I use as a base for all my forms. In the save()
method of AuditModelForm, I can set the updated_by field of the model
and do anything else I want.

-- 
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: Break with Django SVN r6718

2007-11-30 Thread Josh Stone
Hi all,

I'm having problems using Review Board with recent Django revisions, and I'm
hoping that this list can help.  Please see below for the previous
discussion, but the gist is that with Django r6718 (and later), I'm getting
exceptions when urls.py tries to access site settings.  I did some
debugging, and it seems that urls.py is only getting the default settings,
so all of the custom settings are missing from the object.

1. If I run "./manage.py runserver 0.0.0.0:8080", I get exceptions.
2. If I run "env DJANGO_SETTINGS_MODULE=reviewboard.settings ./manage.py
runserver 0.0.0.0:8080", I get exceptions.
3. If I run "./manage.py runserver --settings=reviewboard.settings
0.0.0.0:8080", it works fine!

Everything works fine though with Django r6717, so something in that change
must have broken this.  It's not a big change, but I'm at a loss as to what
the problem is.  The Review Board developers are not able to reproduce this,
but they're using Python 2.5 and mine is Python 2.4.

Any ideas?

Thanks,

Josh


-- Forwarded message --
From: Christian Hammond <[EMAIL PROTECTED]>
Date: Nov 30, 2007 3:05 PM
Subject: Re: Break with Django SVN r6718
To: [EMAIL PROTECTED]


That's very strange... I don't have any ideas. It's working perfectly fine
here. There must be some subtlety that we're missing.

I am using Python 2.5, though. Maybe there's some bug they introduced with
2.4.

Christian


On Nov 30, 2007 2:57 PM, Josh Stone <[EMAIL PROTECTED]> wrote:

> Yes, this is with devserver.sh.  I just tried a completely clean copy, to
> make sure it's not my settings, and I still get the exception.
> settings_local.py is exactly the same as the template except I changed it to
> sqlite3 instead of mysql.
>
> Here's the latest I tried: Review Board r1038, djblets r11659, Django
> r6782, Python 2.4.3
>
> Any ideas?
>
> Josh
>
>
> On Nov 29, 2007 10:03 PM, Christian Hammond <[EMAIL PROTECTED]> wrote:
>
> >  This is with devserver.sh? I just synced to 6718 and I'm having no
> > problems there either. Also tried the latest revision and it's working too.
> >
> > Christian
> >
> >
> >
> > On Nov 29, 2007 6:22 PM, Josh Stone < [EMAIL PROTECTED]> wrote:
> >
> > > When I run Review Board (r1032) with Django r6718 or later, I see this
> > > exception in the browser:
> > >
> > > Error while importing URLconf 'reviewboard.urls ': 'Settings' object
> > > has no attribute 'BUILTIN_AUTH'
> > >
> > > What's weird is that the debug output dumps the settings down below,
> > > and BUILTIN_AUTH looks fine.  So I stepped into reviewboard.urls with
> > > the debugger, and found that the 'settings' object was missing everything
> > > from settings.py and settings_local.py, even though they all show up
> > > in the exception dump!
> > >
> > > Django r6717 works fine, but r6718 breaks (gotta love git-bisect).
> > > However, if I pass "--settings= reviewboard.settings" to manage.py,
> > > everything works fine.
> > >
> > > Has anyone else seen this?  I would guess that it's a Django bug, not
> > > RB's, but hopefully someone more familiar with Django innards can take a
> > > look...
> > >
> > > Thanks,
> > >
> > > Josh
> > >
> > >
> > >
> >
> >
> > --
> > Christian Hammond - [EMAIL PROTECTED]
> > VMware, Inc.
> >
> >
>
>
>


-- 
Christian Hammond - [EMAIL PROTECTED]
VMware, Inc.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Fwd: Break with Django SVN r6718

2007-12-04 Thread Josh Stone

I just found that commit 6871 fixed the problem by reverting 6718:
"Undid [6718], as it broke 'django-admin.py runserver' for a
reason I haven't figured out yet"

But since there still seems to be some mystery, I went on with some
debugging on 6718 anyway below.

On Dec 2, 6:53 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Try to reduce the problem to something a bit simpler, since there's a
> large package involved here (that I, and probably a lot of other people
> on this list, know nothing about).

I'm sorry, you're right, I should have pared down the problem first.

> Does just creating a simple Django project from scratch work for you
> (e.g. the tutorial application)?

I started a new 'mysite' as described in the beginning of the
tutorial, and verified that I could get the "Welcome to Django" page.
Then I made the following simple changes:

  Add to settings.py:
FOOBAR = 42

  Add to urls.py:
from django.conf import settings
print settings.FOOBAR

Then when I visit the site, I get an ImproperlyConfigured exception,
"Error while importing URLconf 'mysite.urls': 'Settings' object has no
attribute 'FOOBAR'".  But if I add "--settings=mysite.settings" to the
manage.py command line, then it works fine.

> What operating system are you running on (there could well be Windows
> vs. Mac vs. Linux vs. OS/2 differences)? What exceptions do you get?
> Just the standard "can't find settings" exception, or something else?

This is RHEL5.1, with python-2.4.3-19.el5.  The exception is always
the same, as quoted above.

Let me know if I should try anything else.  Otherwise I'll just use
Django after 6718 was reverted, where things are fine for me.

Josh
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Fwd: Break with Django SVN r6718

2007-12-10 Thread Josh Stone
I'm not sure what else to try, but let me know if there's something specific
you want to see.  Here's a similar session to what you ran, but note that I
demonstrate 6717 working first.  Also note that I'm running Django from
'~/mysite/django'; I don't have any Django version installed in
site-packages.

~/mysite$ rpm -q python
python-2.4.3-19.el5
~/mysite$ python
Python 2.4.3 (#1, Dec 11 2006, 11:38:52)
[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
~/mysite$ ./manage.py runserver
Validating models...
0 errors found

Django version 0.97-pre-SVN-6717, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
42
[10/Dec/2007 12:59:53] "GET / HTTP/1.1" 404 2053
~/mysite$ (cd django && svn up -r6718)
Ucore/management/__init__.py
Updated to revision 6718.
~/mysite$ ./manage.py runserver
Validating models...
0 errors found

Django version 0.97-pre-SVN-6718, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[10/Dec/2007 13:00:40] "GET / HTTP/1.1" 500 47596
~/mysite$ ./manage.py runserver --settings=mysite.settings
Validating models...
0 errors found

Django version 0.97-pre-SVN-6718, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
42
[10/Dec/2007 13:01:07] "GET / HTTP/1.1" 404 2053


Josh

On Dec 9, 2007 7:15 AM, Todd O'Bryan <[EMAIL PROTECTED]> wrote:

>
> Crapola.
>
> r6718 was a patch I wrote. Without the patch you only get app-defined
> commands if you use manage.py. With django-admin.py, you don't get
> app-defined commands, even if you specify a --settings=path module.
>
> I just tried the steps you mentioned and everything works fine, both
> in Python 2.4 and 2.5:
>
> [EMAIL PROTECTED]:~/Desktop/mysite$ python2.4
> Python 2.4.4 (#2, Oct  4 2007, 22:02:31)
> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> [EMAIL PROTECTED]:~/Desktop/mysite$ python2.4 manage.py runserver
> Validating models...
> 0 errors found
>
> Django version 0.97-pre-SVN-6718, using settings 'mysite.settings'
> Development server is running at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
> 42
> [09/Dec/2007 09:11:40] "GET / HTTP/1.1" 404 2053
> [EMAIL PROTECTED]:~/Desktop/mysite$ python
> Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> [EMAIL PROTECTED]:~/Desktop/mysite$ python manage.py runserver
> Validating models...
> 0 errors found
>
> Django version 0.97-pre-SVN-6718, using settings 'mysite.settings'
> Development server is running at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
> 42
> [09/Dec/2007 09:12:17] "GET / HTTP/1.1" 404 2053
>
> Can you provide any other debugging information that might help me
> narrow down the problem?
>
> Adrian, what errors were you seeing that caused the revert?
>
> Todd
> (Sorry it took me so long to get to this--teaching has been a bear
> recently.)
>
> On Dec 4, 2007 5:37 PM, Josh Stone <[EMAIL PROTECTED]> wrote:
> >
> > I just found that commit 6871 fixed the problem by reverting 6718:
> > "Undid [6718], as it broke 'django-admin.py runserver' for a
> > reason I haven't figured out yet"
> >
> > But since there still seems to be some mystery, I went on with some
> > debugging on 6718 anyway below.
> >
> > On Dec 2, 6:53 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
> > > Try to reduce the problem to something a bit simpler, since there's a
> > > large package involved here (that I, and probably a lot of other
> people
> > > on this list, know nothing about).
> >
> > I'm sorry, you're right, I should have pared down the problem first.
> >
> > > Does just creating a simple Django project from scratch work for you
> > > (e.g. the tutorial application)?
> >
> > I started a new 'mysite' as described in the beginning of the
> > tutorial, and verified that I could get the "Welcome to Django" page.
> > Then I made the following simple changes:
> >
> >   Add t

Re: Fwd: Break with Django SVN r6718

2007-12-10 Thread Josh Stone
On Dec 10, 2007 3:03 PM, Todd O'Bryan <[EMAIL PROTECTED]> wrote:

> Hmm. What you said about not having Django installed in site-packages
> makes me think...
>
> What does your PYTHONPATH environment variable have in it?
>

I wasn't setting PYTHONPATH to anything.  Normally packages are picked up
just fine when they're in the current directory.  I put Django there because
I would rather not add pre-release software to site-packages.

I had a hunch that having Django in the current directory was the problem,
and now that seems to be confirmed.  Here are some more trials:

   - Django in site-packages only: works
   - Django in site-packages and in $PWD: fails
   - Django in $SOMEDIR and PYTHONPATH=$SOMEDIR: works
   - Django in $SOMEDIR and in $PWD, and PYTHONPATH=$SOMEDIR: fails
   - Django in $PWD only: fails
   - Django in $PWD and PYTHONPATH=$PWD: fails

Any of the failure cases will work if I add '--settings=mysite.settings' to
the command line, or if I use a revision that doesn't have your 6718 change.

Do you possibly have the current directory listed before the path to
> Django? Because if you try to
>
> from django.conf import settings
>
> before your settings module has been identified, weird things might
> happen. (I don't know what exactly...I'm grasping at straws at the
> moment.)
>

It does look like the settings object that I get in urls.py has only the
default settings and none of the local settings.  But I don't know how 6718
changed this behavior, or why adding --settings fixes it.


Josh

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



user authentication with extended (AbstractUser) user model

2013-06-17 Thread Evan Stone
Per the docs for Django 1.5, I have attempted to broaden the range of data 
held in the default user model by making an extended user model with the 
AbstractUser class. I made the model (called "Client") and listed it in 
settings.py as the AUTH_USER_MODEL. Syncdb took it and it worked great. 
Specifically, syncdb made a new MySQL table with all the default user 
fields AND my own additional fields, followed by two related tables for 
user permissions. I was pretty excited about all this until I tried to 
authenticate a user. Apparently, the built-in authenticate method is still 
pointing at the built-in user model. How can I point that method to my new 
custom model instead?

Fyi, I created new users in the Client model through the djangoized python 
shell and used set_password to create the passwords. I checked the MySQL 
tables to verify that my new user records in my Client table looked just 
like a new user in the built-in user table (auth-user). They did. But they 
won't authenticate. To double-check, I then made a new user in the built-in 
user model and it authenticated just fine. 

I've read about coding custom authentication with a totally customized user 
model--it looks quite involved and that really shouldn't be necessary for 
what I'm doing, because my model isn't custom. I've simply extended the 
existing user model and wish to authenticate users based on that model. 
There has to be an easier way. Any advice?

Thanks!

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




Re: user authentication with extended (AbstractUser) user model

2013-06-18 Thread Evan Stone
Russ, 

Thanks so much for getting back to me! I shouldn't have posted that without 
my code in front of me... (was posting from my phone, in bed) 

It turns out that I did NOT have AUTH_USER_MODEL set. I had 
AUTH_PROFILE_MODULE set.

I changed it to AUTH_USER_MODEL and followed the custom user model example 
in the docs. I was really reluctant to do so earlier because the docs make 
it sound like everything is pain moving forward with a custom user model. 
Is it?


On Monday, June 17, 2013 6:50:23 PM UTC-5, Russell Keith-Magee wrote:
>
>
> On Mon, Jun 17, 2013 at 10:31 PM, Evan Stone 
> > wrote:
>
>> Per the docs for Django 1.5, I have attempted to broaden the range of 
>> data held in the default user model by making an extended user model with 
>> the AbstractUser class. I made the model (called "Client") and listed it in 
>> settings.py as the AUTH_USER_MODEL. Syncdb took it and it worked great. 
>> Specifically, syncdb made a new MySQL table with all the default user 
>> fields AND my own additional fields, followed by two related tables for 
>> user permissions. I was pretty excited about all this until I tried to 
>> authenticate a user. Apparently, the built-in authenticate method is still 
>> pointing at the built-in user model. How can I point that method to my new 
>> custom model instead?
>>
>> Fyi, I created new users in the Client model through the djangoized 
>> python shell and used set_password to create the passwords. I checked the 
>> MySQL tables to verify that my new user records in my Client table looked 
>> just like a new user in the built-in user table (auth-user). They did. But 
>> they won't authenticate. To double-check, I then made a new user in the 
>> built-in user model and it authenticated just fine. 
>>
>> I've read about coding custom authentication with a totally customized 
>> user model--it looks quite involved and that really shouldn't be necessary 
>> for what I'm doing, because my model isn't custom. I've simply extended the 
>> existing user model and wish to authenticate users based on that model. 
>> There has to be an easier way. Any advice?
>>
>> Hi Evan,
>
> It's difficult to say what's going on without seeing code. However, if 
> AUTH_USER_MODEL is set as you describe, then the built-in User table 
> shouldn't even be created, so it shouldn't be possible for the built-in 
> auth_user table to be used for authentication purposes.
>
> So - it sounds like there's something wonky in your basic project 
> configuration. 
>
> The simplest test I can think of is to run ./manage.py createsuperuser. 
>  This command should ask you for all the REQUIRED_FIELDS on your model, and 
> then store an object with superuser permissions in your custom User table. 
> If this doesn't happen, then you know you have a low level configuration 
> problem. createsuperuser doesn't get involved with any of the 
> authentication code -- it's a very low level tool for dealing with the 
> "User" model (whichever User that is), so it's a good test to see if your 
> project is finding your custom User model.
>
> Another test would be to open a ./manage.py shell and run:
>
> $ from django.contrib.auth import get_user_model
> $ print get_user_model()
>
> If that doesn't point at your custom User model, you have a problem.
>
> As for your question about custom coding authentication -- this should 
> only be needed if your custom User model doesn't meet the basic 
> requirements of Django's User. If you have a single unique field that is an 
> identifier (e.g., a username, and email address, or some other identifier 
> of some kind), then you should be able to use Django's built-in 
> authentication.
>
> Yours,
> Russ Magee %-)
>

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




Re: user authentication with extended (AbstractUser) user model

2013-06-19 Thread Evan Stone
Sure thing. Here are the snippets that gave me pause:

"Think carefully before handling information not directly related to 
authentication in your custom User Model.

It may be better to store app-specific user information in a model that has 
a relation with the User model. That allows each app to specify its own 
user data requirements without risking conflicts with other apps"

along with

"One limitation of custom User models is that installing a custom User 
model will break any proxy model extending 
User<https://docs.djangoproject.com/en/1.5/ref/contrib/auth/#django.contrib.auth.models.User>.
 
..."

and

"Another limitation of custom User models is that you can’t use 
django.contrib.auth.get_user_model()<https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#django.contrib.auth.get_user_model>
 as 
the sender or target of "




On Tuesday, June 18, 2013 6:34:16 PM UTC-5, Russell Keith-Magee wrote:
>
>
> On Tue, Jun 18, 2013 at 11:37 PM, Evan Stone 
> > wrote:
>
>> Russ, 
>>
>> Thanks so much for getting back to me! I shouldn't have posted that 
>> without my code in front of me... (was posting from my phone, in bed) 
>>
>> It turns out that I did NOT have AUTH_USER_MODEL set. I had 
>> AUTH_PROFILE_MODULE set.
>>
>
> Ah - that'll do it :-) 
>  
>
>> I changed it to AUTH_USER_MODEL and followed the custom user model 
>> example in the docs. I was really reluctant to do so earlier because the 
>> docs make it sound like everything is pain moving forward with a custom 
>> user model. Is it?
>>
>  
> There are some things you need to keep in mind, but they're generally 
> complications because you can't rely on User having a 30 character username 
> and option email address, and so on. The trivial solution will always to be 
> the builtin User model, but as long as you're aware of the assumptions 
> you're making about your user model, switching to a new User model 
> shouldn't be too much pain at all. The changes required should be 
> relatively obvious -- for example, you'll need a new form definition for 
> any User-based forms, because Django can't know what fields are needed for 
> *your* User model.
>
> Can you elaborate what aspect of the docs made you feel like the process 
> of using a custom User model would be a pain? We added the feature because 
> we feel it will be useful (and in my experience so far, it is). We want 
> people to be aware that there will be complications, but we don't want to 
> unilaterally scare people off. 
>
> Yours,
> Russ Magee %-)
>

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




Re: user authentication with extended (AbstractUser) user model

2013-06-19 Thread Evan Stone
Also, thank you again!

On Wednesday, June 19, 2013 3:16:05 PM UTC-5, Evan Stone wrote:
>
> Sure thing. Here are the snippets that gave me pause:
>
> "Think carefully before handling information not directly related to 
> authentication in your custom User Model.
>
> It may be better to store app-specific user information in a model that 
> has a relation with the User model. That allows each app to specify its own 
> user data requirements without risking conflicts with other apps"
>
> along with
>
> "One limitation of custom User models is that installing a custom User 
> model will break any proxy model extending 
> User<https://docs.djangoproject.com/en/1.5/ref/contrib/auth/#django.contrib.auth.models.User>.
>  
> ..."
>
> and
>
> "Another limitation of custom User models is that you can’t use 
> django.contrib.auth.get_user_model()<https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#django.contrib.auth.get_user_model>
>  as 
> the sender or target of "
>
>
>
>
> On Tuesday, June 18, 2013 6:34:16 PM UTC-5, Russell Keith-Magee wrote:
>>
>>
>> On Tue, Jun 18, 2013 at 11:37 PM, Evan Stone  wrote:
>>
>>> Russ, 
>>>
>>> Thanks so much for getting back to me! I shouldn't have posted that 
>>> without my code in front of me... (was posting from my phone, in bed) 
>>>
>>> It turns out that I did NOT have AUTH_USER_MODEL set. I had 
>>> AUTH_PROFILE_MODULE set.
>>>
>>
>> Ah - that'll do it :-) 
>>  
>>
>>> I changed it to AUTH_USER_MODEL and followed the custom user model 
>>> example in the docs. I was really reluctant to do so earlier because the 
>>> docs make it sound like everything is pain moving forward with a custom 
>>> user model. Is it?
>>>
>>  
>> There are some things you need to keep in mind, but they're generally 
>> complications because you can't rely on User having a 30 character username 
>> and option email address, and so on. The trivial solution will always to be 
>> the builtin User model, but as long as you're aware of the assumptions 
>> you're making about your user model, switching to a new User model 
>> shouldn't be too much pain at all. The changes required should be 
>> relatively obvious -- for example, you'll need a new form definition for 
>> any User-based forms, because Django can't know what fields are needed for 
>> *your* User model.
>>
>> Can you elaborate what aspect of the docs made you feel like the process 
>> of using a custom User model would be a pain? We added the feature because 
>> we feel it will be useful (and in my experience so far, it is). We want 
>> people to be aware that there will be complications, but we don't want to 
>> unilaterally scare people off. 
>>
>> Yours,
>> Russ Magee %-)
>>
>

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




Re: user authentication with extended (AbstractUser) user model

2013-06-20 Thread Evan Stone
Thanks for opening the ticket and thanks so much for the explanation as 
well! 


-evan


On Wednesday, June 19, 2013 7:13:04 PM UTC-5, Russell Keith-Magee wrote:
>
>
> On Thu, Jun 20, 2013 at 4:16 AM, Evan Stone 
> > wrote:
>
>> Sure thing. Here are the snippets that gave me pause:
>>
>> "Think carefully before handling information not directly related to 
>> authentication in your custom User Model.
>>
>> It may be better to store app-specific user information in a model that 
>> has a relation with the User model. That allows each app to specify its own 
>> user data requirements without risking conflicts with other apps"
>>
>> along with
>>
>> "One limitation of custom User models is that installing a custom User 
>> model will break any proxy model extending 
>> User<https://docs.djangoproject.com/en/1.5/ref/contrib/auth/#django.contrib.auth.models.User>.
>>  
>> ..."
>>
>> and
>>
>> "Another limitation of custom User models is that you can’t use 
>> django.contrib.auth.get_user_model()<https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#django.contrib.auth.get_user_model>
>>  as 
>> the sender or target of "
>>
>>
>> Thanks for giving those details. I've opened ticket #20629 [1] to track 
> this problem -- hopefully we can get this documentation cleaned up so we 
> don't scare others in the future.
>
> [1] https://code.djangoproject.com/ticket/20629
>
> By way of explanation:
>
> Points 1 and 2 are asking you to consider an architectural question -- do 
> you need a custom user model at all? If you actually *are* using a 
> username-based login system, and you just want to track some extra 
> information about the user, the right approach may *not* be to create a 
> custom user model.
>
> Points 3 and 4 are pointing out known limitations. Proxy models are a 
> problem because they use subclassing, and they will be subclassing the 
> wrong class; signals are a problem because at the point the signal is 
> registered, there's no guarantee that the User model has been correctly 
> defined. There's not much we can do about (3); (4) is something that should 
> get cleaned up when we eventually land app refactor.
>
> Yours,
> Russ Magee %-)
>
>

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




Re: Hello From Nigeria

2019-03-21 Thread Gabriel Stone
hello i am from Ghana am i qualified to join?

On Thu, Mar 21, 2019 at 1:54 PM Asiwaju Lasisi Prodigy Olatunbosun <
bosun...@gmail.com> wrote:

> Yes 08024273381
>
> On Wednesday, 13 March 2019 12:44:16 UTC+1, Thaddeaus Iorbee wrote:
>>
>> Yes please.  0814390
>>
>> On Monday, March 11, 2019, Joshua Kayode  wrote:
>>
>>> Greetings, if you are a django developer in Nigeria, would you consider
>>> joining a WhatsApp group?
>>>
>>> --
>>> 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/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b36b25cf-7e71-4e39-b2f7-700b76d1bd82%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL-5MpU8FfK_V-K2_D9%2ByhKB%2Bynq-DqjiyLfKCSVV%3D212kRpmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: why is the static file not loading.i need solution

2018-10-20 Thread Gabriel Stone
Also in your href try using a forward slash not a back slash to make
references

On Sat, 20 Oct 2018 at 5:45 PM, Siddharth Tamang <
tamangsiddhart...@gmail.com> wrote:

> Have you defined your static files entry in settings.py?
>
> On Sat, Oct 20, 2018 at 9:05 PM Obodoma Uzondu Vincent <
> uobodoma...@gmail.com> wrote:
>
>> THIS IS THE HTML FILE
>> 
>> login
>> https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css";
>> integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
>> crossorigin="anonymous">
>> {% load static %}
>> > type="text/css">
>>   
>>   
>>
>> 
>>   welcome
>>   Welcome to my page!
>>   Success
>> 
>>   
>> THIS IS THE CSS FILE
>> h1 {
>> color: red;
>>   }
>>
>> --
>> 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/CACsKspkppG6UHwhfXko0z5DO%2BXkk9LvxLwO6dmEjkARRbm7PjA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Thank you
> Siddharth Tamang
> AWS Certified Solutions Architect - Associate
>
> --
> 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/CADBOudswAoq9ncZzBkAbGXUgZ6btX36740tF3L46yQJcK2Lq8A%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL-5MpX1c0St%2B6hD%3DabBLVmE6yVc%3DSrBhX4Q4S%2Bd1eqtPJ40vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: User matching query does not exist.

2019-09-07 Thread Gabriel Stone
In your user creation form did you add an email field?if you did then only
can you query users by their email

On Sat, Sep 7, 2019 at 22:36 göktürk sığırtmaç 
wrote:

> I'm trying get user according to email.
>
> user = User.objects.get(email=email)
>
>
> if user is none, i will show message. I will check password after. But
> when i trying login with wrong email address for test i have error "User
> matching query does not exist.". How can i handle this error to convert
> message. I have tried this
>
> try:
> user = User.objects.get(email=email)
> except:
> user = None;
>
>
> if user is None:
> messages.warning(request, "Email hatalı")
> print("email is wrong")
> return render(request, "login.html", context)
>
>
>  code but my each login attempt, i have message "e mail is wrong"
>
>
> --
> 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/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com
> 
> .
>
-- 
Gabrielstone😎

-- 
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/CAL-5MpWb6fpUZs%3Dvrztc%3DjN8RaUNYax1nwGXegR1J-cG0Mk2dA%40mail.gmail.com.


Re: User matching query does not exist.

2019-09-07 Thread Gabriel Stone
Tamam all the best

On Sat, Sep 7, 2019 at 23:12 göktürk sığırtmaç 
wrote:

> I solved it!!! using ObjectDoesNotExist via javatpoint. (
> https://www.javatpoint.com/django-exceptions)
>
> try:
> user = User.objects.get(email=email)
> except ObjectDoesNotExist:
> user = None;
>
>
> 7 Eylül 2019 Cumartesi 23:36:00 UTC+3 tarihinde göktürk sığırtmaç yazdı:
>>
>> I'm trying get user according to email.
>>
>> user = User.objects.get(email=email)
>>
>>
>> if user is none, i will show message. I will check password after. But
>> when i trying login with wrong email address for test i have error "User
>> matching query does not exist.". How can i handle this error to convert
>> message. I have tried this
>>
>> try:
>> user = User.objects.get(email=email)
>> except:
>> user = None;
>>
>>
>> if user is None:
>> messages.warning(request, "Email hatalı")
>> print("email is wrong")
>> return render(request, "login.html", context)
>>
>>
>>  code but my each login attempt, i have message "e mail is wrong"
>>
>>
>> --
> 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/0b36cb1f-d42c-4783-86a7-fcfaf0cbfb99%40googlegroups.com
> 
> .
>
-- 
Gabrielstone😎

-- 
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/CAL-5MpV8y_rfdDxDR7KsgCeD%3Dys3aQALvi_yOGeWOyYqtBrw_Q%40mail.gmail.com.