Search Results

Search found 5330 results on 214 pages for 'django auth'.

Page 30/214 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • django+uploadify - don't working

    - by Erico
    Hi, I'm trying to use an example posted on the "github" the link is http://github.com/tstone/django-uploadify. And I'm having trouble getting work. can you help me? I followed step by step, but does not work. Accessing the "URL" / upload / the only thing is that returns "True" part of settings.py import os PROJECT_ROOT_PATH = os.path.dirname(os.path.abspath(file)) MEDIA_ROOT = os.path.join(PROJECT_ROOT_PATH, 'media') TEMPLATE_DIRS = ( os.path.join(PROJECT_ROOT_PATH, 'templates')) urls.py from django.conf.urls.defaults import * from django.conf import settings from teste.uploadify.views import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), url(r'upload/$', upload, name='uploadify_upload'), ) views.py from django.http import HttpResponse import django.dispatch upload_received = django.dispatch.Signal(providing_args=['data']) def upload(request, *args, **kwargs): if request.method == 'POST': if request.FILES: upload_received.send(sender='uploadify', data=request.FILES['Filedata']) return HttpResponse('True') models.py from django.db import models def upload_received_handler(sender, data, **kwargs): if file: new_media = Media.objects.create( file = data, new_upload = True, ) new_media.save() upload_received.connect(upload_received_handler, dispatch_uid='uploadify.media.upload_received') class Media(models.Model): file = models.FileField(upload_to='images/upload/', null=True, blank=True) new_upload = models.BooleanField() uploadify_tags.py from django import template from teste import settings register = template.Library() @register.inclusion_tag('uploadify/multi_file_upload.html', takes_context=True) def multi_file_upload(context, upload_complete_url): """ * filesUploaded - The total number of files uploaded * errors - The total number of errors while uploading * allBytesLoaded - The total number of bytes uploaded * speed - The average speed of all uploaded files """ return { 'upload_complete_url' : upload_complete_url, 'uploadify_path' : settings.UPLOADIFY_PATH, # checar essa linha 'upload_path' : settings.UPLOADIFY_UPLOAD_PATH, } template - uploadify/multi_file_upload.html {% load uploadify_tags }{ multi_file_upload '/media/images/upload/' %} <script type="text/javascript" src="{{ MEDIA_URL }}js/swfobject.js"></script> <script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.uploadify.js"></script> <div id="uploadify" class="multi-file-upload"><input id="fileInput" name="fileInput" type="file" /></div> <script type="text/javascript">// <![CDATA[ $(document).ready(function() { $('#fileInput').uploadify({ 'uploader' : '/media/swf/uploadify.swf', 'script' : '{% url uploadify_upload %}', 'cancelImg' : '/media/images/uploadify-remove.png/', 'auto' : true, 'folder' : '/media/images/upload/', 'multi' : true, 'onAllComplete' : allComplete }); }); function allComplete(event, data) { $('#uploadify').load('{{ upload_complete_url }}', { 'filesUploaded' : data.filesUploaded, 'errorCount' : data.errors, 'allBytesLoaded' : data.allBytesLoaded, 'speed' : data.speed }); // raise custom event $('#uploadify') .trigger('allUploadsComplete', data); } // ]]</script>

    Read the article

  • django: can't adapt error when importing data from postgres database

    - by Oleg Tarasenko
    Hi, I'm having strange error with installing fixture from dumped data. I am using psycopg2, and django1.1.1 silver:probsbox oleg$ python manage.py loaddata /Users/oleg/probs.json Installing json fixture '/Users/oleg/probs' from '/Users/oleg/probs'. Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last): File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/loaddata.py", line 153, in handle obj.save() File "/opt/local/lib/python2.5/site-packages/django/core/serializers/base.py", line 163, in save models.Model.save_base(self.object, raw=True) File "/opt/local/lib/python2.5/site-packages/django/db/models/base.py", line 495, in save_base result = manager._insert(values, return_id=update_pk) File "/opt/local/lib/python2.5/site-packages/django/db/models/manager.py", line 177, in _insert return insert_query(self.model, values, **kwargs) File "/opt/local/lib/python2.5/site-packages/django/db/models/query.py", line 1087, in insert_query return query.execute_sql(return_id) File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.py", line 320, in execute_sql cursor = super(InsertQuery, self).execute_sql(None) File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 2369, in execute_sql cursor.execute(sql, params) File "/opt/local/lib/python2.5/site-packages/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) ProgrammingError: can't adapt First I've checked similar issues on internet. This one seemed to be very related: http://code.djangoproject.com/ticket/5996, as my data has many non ASCII symbols But actually I've checked my django installation and it's ok there Could you advice what is wrong

    Read the article

  • django+mod_wsgi on virtualenv not working

    - by jwesonga
    I've just finished setting up a django app on virtualenv, deployment went smoothly using a fabric script, but now the .wsgi is not working, I've tried every variation on the internet but no luck. My .wsgi file is: import os import sys import django.core.handlers.wsgi # put the Django project on sys.path root_path = os.path.abspath(os.path.dirname(__file__) + '../') sys.path.insert(0, os.path.join(root_path, 'kcdf')) sys.path.insert(0, root_path) os.environ['DJANGO_SETTINGS_MODULE'] = 'kcdf.settings' application = django.core.handlers.wsgi.WSGIHandler() I keep getting the same error: [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] mod_wsgi (pid=16938): Exception occurred processing WSGI script '/home/kcdfweb/webapps/kcdf.web/releases/current/kcdf/apache/kcdf.wsgi'. [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] Traceback (most recent call last): [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 230, in __call__ [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] self.load_middleware() [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 33, in load_middleware [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] for middleware_path in settings.MIDDLEWARE_CLASSES: [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 269, in __getattr__ [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] self._setup() [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 40, in _setup [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] self._wrapped = Settings(settings_module) [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 75, in __init__ [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e) [Sun Apr 18 12:44:30 2010] [error] [client 41.215.123.159] ImportError: Could not import settings 'kcdf.settings' (Is it on sys.path? Does it have syntax errors?): No module named kcdf.settings my virtual environment is on /home/user/webapps/kcdfweb my app is /home/user/webapps/kcdf.web/releases/current/project_name my wsgi file home/user/webapps/kcdf.web/releases/current/project_name/apache/project_name.wsgi

    Read the article

  • Trying to get django app to work with mod_wsgi on CentOS 5

    - by David
    I'm running CentOS 5, and am trying to get a django application working with mod_wsgi. I'm using .wsgi settings I got working on Ubuntu. Here is the error: [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] SystemError: dynamic module not initialized properly [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] mod_wsgi (pid=23630): Target WSGI script '/data/hosting/cubedev/apache/django.wsgi' cannot be loaded as Python module. [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] mod_wsgi (pid=23630): Exception occurred processing WSGI script '/data/hosting/cubedev/apache/django.wsgi'. [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] Traceback (most recent call last): [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] File "/data/hosting/cubedev/apache/django.wsgi", line 8, in [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] import django.core.handlers.wsgi [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] File "/opt/python2.6/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 1, in [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] from threading import Lock [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] File "/opt/python2.6/lib/python2.6/threading.py", line 13, in [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] from functools import wraps [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] File "/opt/python2.6/lib/python2.6/functools.py", line 10, in [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] from _functools import partial, reduce [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] SystemError: dynamic module not initialized properly And here is my .wsgi file import os import sys os.environ['PYTHON_EGG_CACHE'] = '/tmp/django/' os.environ['DJANGO_SETTINGS_MODULE'] = 'cube.settings' sys.path.append('/data/hosting/cubedev') import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()

    Read the article

  • Error in django using Apache & mod_wsgi

    - by Ignacio
    Hey, I've been doing some changes to my django develpment env, as some of you suggested. So far I've managed to configure and run it successfully with postgres. Now I'm trying to run the app using apache2 and mod_wsgi, but I ran into this little problem after I followed the guidelines from the django docs. When I access localhost/myapp/tasks this error raises: Request Method: GET Request URL: http://localhost/myapp/tasks/ Exception Type: TemplateSyntaxError Exception Value: Caught an exception while rendering: argument 1 must be a string or unicode object Original Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py", line 71, in render_node result = node.render(context) File "/usr/local/lib/python2.6/dist-packages/django/template/defaulttags.py", line 126, in render len_values = len(values) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 81, in __len__ self._result_cache = list(self.iterator()) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 238, in iterator for row in self.query.results_iter(): File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 287, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 2369, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) TypeError: argument 1 must be a string or unicode object ... ... ... And then it highlights a {% for t in tasks %} template tag, like the source of the problem is there, but it worked fine on the built-in server. The view associated with that page is really simple, just fetch all Task objects. And the template just displays them on a table. Also, some pages get rendered ok. Don't want to fill this Question with code, so if you need some more info I'd be glad to provide it. Thanks

    Read the article

  • Ubuntu 12.04 Preseed LDAP Config

    - by Arturo
    I'm trying to deploy Ubuntu 12.04 via xCAT, everything works except the automatic configuration of LDAP, the preseed file is read but the file /etc/nsswitch is not written properly. My Preseed File: [...] ### LDAP Setup nslcd nslcd/ldap-bindpw password ldap-auth-config ldap-auth-config/bindpw password ldap-auth-config ldap-auth-config/rootbindpw password ldap-auth-config ldap-auth-config/binddn string cn=proxyuser,dc=example,dc=net libpam-runtime libpam-runtime/profiles multiselect unix, ldap, gnome-keyring, consolekit, capability ldap-auth-config ldap-auth-config/dbrootlogin boolean false ldap-auth-config ldap-auth-config/rootbinddn string cn=manager,dc=xcat-domain,dc=com nslcd nslcd/ldap-starttls boolean false nslcd nslcd/ldap-base string dc=xcat-domain,dc=com ldap-auth-config ldap-auth-config/pam_password select md5 ldap-auth-config ldap-auth-config/move-to-debconf boolean true ldap-auth-config ldap-auth-config/ldapns/ldap-server string ldap://192.168.32.42 ldap-auth-config ldap-auth-config/ldapns/base-dn string dc=xcat-domain,dc=com ldap-auth-config ldap-auth-config/override boolean true libnss-ldapd libnss-ldapd/clean_nsswitch boolean false libnss-ldapd libnss-ldapd/nsswitch multiselect passwd,group,shadow nslcd nslcd/ldap-reqcert select ldap-auth-config ldap-auth-config/ldapns/ldap_version select 3 ldap-auth-config ldap-auth-config/dblogin boolean false nslcd nslcd/ldap-uris string ldap://192.168.32.42 nslcd nslcd/ldap-binddn string [...] After the installation, nsswitch.conf rimains unchanged. Has someone an idea?? Thanks!

    Read the article

  • Solaris ldap Authentication

    - by Tman
    Iv been having a trouble trying to get my Solaris 10 server to authenticate against an eDir server.im managed to Set up my linux(RHeL,SLES) servers to authenticate against the ldap Server.which works fine. Here is my configuration Files. ldapclient list: NS_LDAP_FILE_VERSION= 2.0 NS_LDAP_BINDDN= cn=proxyuser,o=AEDev NS_LDAP_BINDPASSWD= {NS1}ecfa88f3a945c22222233 NS_LDAP_SERVERS= 192.168.0.19 NS_LDAP_SEARCH_BASEDN= ou=auth,o=AEDev NS_LDAP_AUTH= simple NS_LDAP_SEARCH_SCOPE= sub NS_LDAP_CACHETTL= 0 NS_LDAP_CREDENTIAL_LEVEL= anonymous NS_LDAP_SERVICE_SEARCH_DESC= group:ou=Groups,ou=auth,o=AEDev NS_LDAP_SERVICE_SEARCH_DESC= shadow:ou=users,ou=auth,o=AEDev?sub?objectClass=shadowAccount NS_LDAP_SERVICE_SEARCH_DESC= passwd:ou=auth,o=AEDev?sub?objectClass=posixAccount NS_LDAP_BIND_TIME= 10 NS_LDAP_SERVICE_AUTH_METHOD= pam_ldap:simple getent passwd works fine: root:x:0:0:Super-User:/:/sbin/sh daemon:x:1:1::/: bin:x:2:2::/usr/bin: sys:x:3:3::/: adm:x:4:4:Admin:/var/adm: lp:x:71:8:Line Printer Admin:/usr/spool/lp: uucp:x:5:5:uucp Admin:/usr/lib/uucp: nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico smmsp:x:25:25:SendMail Message Submission Program:/: listen:x:37:4:Network Admin:/usr/net/nls: gdm:x:50:50:GDM Reserved UID:/: webservd:x:80:80:WebServer Reserved UID:/: postgres:x:90:90:PostgreSQL Reserved UID:/:/usr/bin/pfksh svctag:x:95:12:Service Tag UID:/: nobody:x:60001:60001:NFS Anonymous Access User:/: noaccess:x:60002:60002:No Access User:/: nobody4:x:65534:65534:SunOS 4.x NFS Anonymous Access User:/: tlla:x:2012:100::/home/tlla: test:x:2011:100::/home/test: thato:x:2010:100::/home/thato: pam.conf login auth sufficient pam_unix_auth.so.1 #server_policy login auth sufficient /usr/lib/security/pam_ldap.so.1 try_first_pass login auth required pam_dial_auth.so.1 rlogin auth sufficient pam_rhosts_auth.so.1 rlogin auth requisite pam_authtok_get.so.1 rlogin auth required pam_dhkeys.so.1 rlogin auth required pam_unix_cred.so.1 rlogin auth sufficient pam_unix_auth.so.1 rlogin auth sufficient /usr/lib/security/pam_ldap.so.1 try_first_pass rsh auth sufficient pam_rhosts_auth.so.1 rsh auth required pam_unix_cred.so.1 rsh auth sufficient pam_unix_auth.so.1 #server_policy rsh auth sufficient /usr/lib/security/pam_ldap.so.1 try_first_pass other auth requisite pam_authtok_get.so.1 other auth required pam_dhkeys.so.1 other auth required pam_unix_cred.so.1 other auth sufficient pam_unix_auth.so.1 other auth sufficient /usr/lib/security/pam_ldap.so.1 try_first_pass passwd auth required pam_passwd_auth.so.1 passwd auth sufficient pam_unix_auth.so.1 ssh account sufficient pam_unix.so.1 ssh account sufficient /usr/lib/security/pam_ldap.so.1 try_first_pass other account requisite pam_roles.so.1 other account sufficient pam_unix_account.so.1 other account sufficient /usr/lib/security/pam_ldap.so.1 try_first_pass other password required pam_dhkeys.so.1 other password requisite pam_authtok_get.so.1 other password requisite pam_authtok_check.so.1 other password required pam_authtok_store.so.1 other password sufficient pam_unix.so.1 other password sufficient /usr/lib/security/pam_ldap.so.1 try_first_pass Local Authentication Works But LDAP Authentication Doesn't Work.

    Read the article

  • Building a formset dynamically

    - by vorpyg
    I initially wrote code to build a form dynamically, based on data from the DB, similar to what I described in my previous SO post. As SO user Daniel Roseman points out, he would use a formset for this, and now I've come to the realization that he must be completely right. :) My approach works, basically, but I can't seem to get validation across the entire form to be working properly (I believe it's possible, but it's getting quite complex, and there has to be a smarter way of doing it = Formsets!). So now my question is: How can I build a formset dynamically? Not in an AJAX way, I want each form's label to be populated with an FK value (team) from the DB. As I have a need for passing parameters to the form, I've used this technique from a previous SO post. With the former approach, my view code is (form code in previous link): def render_form(request): teams = Team.objects.filter(game=game) form_collection = [] for team in teams: f = SuggestionForm(request.POST or None, team=team, user=request.user) form_collection.append(f) Now I want to do something like: def render_form(request): teams = Team.objects.filter(game=game) from django.utils.functional import curry from django.forms.formsets import formset_factory formset = formset_factory(SuggestionForm) for team in teams: formset.form.append(staticmethod(curry(SuggestionForm, request.POST or None, team=team, user=request.user))) But the append bit doesn't work. What's the proper way of doing this? Thanks!

    Read the article

  • Deploying Django at Dreamhost

    - by Imran
    I'm trying to get the Poll tutorial working at my Dreamhost account (I don't have any prior experience of deploying Django). I downloaded the script I found here (http://gabrielfalcao.com/2008/12/02/hosting-and-deploying-django-apps-on-dreamhost/) at my home directory and executed it. Now I have Python 2.5 and Django in ~/.myroot/ and my Django projects directory is ~/projects/ Here's the content of ~/projects/ directory (I copied the polls/ and and templates/polls/ directories myself). projects/ |-- admin_media -> /home/imran2140/.myroot/usr/lib/python2.5/site-packages/django/contrib/admin/media |-- dispatch.fcgi |-- polls | |-- __init__.py | |-- __init__.pyc | |-- admin.py | |-- admin.pyc | |-- models.py | |-- models.pyc | |-- polls.db | |-- urls.py | |-- urls.pyc | |-- views.py | `-- views.pyc |-- script_templates | |-- dispatch.template | `-- htaccess.template `-- templates `-- polls |-- detail.html |-- index.html `-- results.html 5 directories, 17 files Now what should I do to get the Polls app working? Update I finally got a "Hello World" Django app working with Passanger WSGI. It worked fine with both Server's default Python 2.3.5 and my installed Python 2.5.2. Passanger WSGI - Django at Dreamhost Wiki

    Read the article

  • django internationalization and translations problem

    - by Zayatzz
    I have a problem with django translations. Problem 1 - i updated string in django.po file, but the change does not appear on the webpage. Problem 2 - i have created my own locale file with django-admin.py makemessages -l et, added the translation string into file, but they too do not appear on the page. I do not think this is setting problem, because the translations from django.po file do appear on the website, its just the changes and the translations from my own generated file that do not appear. Edit: My settings.py contains this: gettext = lambda s: s LANGUAGE_CODE = 'et' LANGUAGES = ( ('et', gettext('Estonian')), ) my own locale files are in /path/to/project/locale/et/LC_MESSAGES/ and the files are django.mo and django.po the file i refer to in problem 1 is django own et transaltion, which i changed.

    Read the article

  • Why can't I use 'django-admin.py makemessages -l cn'

    - by zjm1126
    print : D:\zjm_code\register2>python D:\Python25\Lib\site-packages\django\bin\django-adm in.py makemessages -l cn Error: This script should be run from the Django SVN tree or your project or app tree. If you did indeed run it from the SVN checkout or your project or applica tion, maybe you are just missing the conf/locale (in the django tree) or locale (for project and application) directory? It is not created automatically, you ha ve to create it by hand if you want to enable i18n for your project or applicati on. 2.i made a locale directory ,and D:\zjm_code\register2>python D:\Python25\Lib\site-packages\django\bin\django-adm in.py makemessages -l cn processing language cn Error: errors happened while running xgettext on __init__.py 'xgettext' ?????????,????????? ??????? D:\Python25\lib\site-packages\django\core\management\base.py:234: RuntimeWarning : tp_compare didn't return -1 or -2 for exception sys.exit(1) 3. ok http://hi.baidu.com/zjm1126/blog/item/f28e09deced15353ccbf1a82.html

    Read the article

  • Writing a custom auth system (like the default django auth system), use it to generate tables in DB

    - by dotty
    Hay all, I've been reading up on middleware and how to use it with a context object. I want to write a simple middleware class which i can use on my own applications, it will essentially be a cut down version of the django one. The problem i seem to have is that if i have INSTALLED_APPS = ('django.contrib.my_auth') in the settings file, all is well. I've also added MIDDLEWARE_CLASSES = ('django.contrib.my_auth.middleware.MyAuthMiddleware') in it and everything is fine. My question is, how would i make my middleware automatically generate tables from a models.py module, much like how the django auth does when i run manage.py syncdb? thanks

    Read the article

  • How do I make a project in Django? Beginner

    - by ggfan
    Okay I just started with Django and it's totally different from PHP. I installed Python 2.6 and Django. Both are located in my C drive. C: Django build django docs Python26 I am doing the django site tutorial and when they say to write django-admin.py startproject mysite from my Python command line, I keep getting: Syntax error: invalid syntax >>>django-admin.py startproject mysite FILE "<stdin>", line 1 django-admin.py startproject mysite ^ My django-admin.py is in the django/bin folder. I installed Python via python setup.py. Am I suppose to use my window's CP? When I do that, I get window's can't open a .py file. I thought I was just creating a folder? How do I create a project with django? Thanks :)

    Read the article

  • OpenVPN: ERROR: could not read Auth username from stdin

    - by user56231
    I managed to setup openvpn but now I want to integrate a user/pass authentication method so, even though I haven't added the auth-nocache in the server config, whenever I try to connect it returns with the following message on the client side: ERROR: could not read Auth username from stdin My server.conf file contains basic stuff, everything works up untill I try to implement this for of authentication. mode server dev tun proto tcp port 1194 keepalive 10 120 plugin /usr/lib/openvpn/openvpn-auth-pam.so login client-cert-not-required username-as-common-name auth-user-pass-verify /etc/openvpn/auth.pl via-env ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt cert /etc/openvpn/easy-rsa/2.0/keys/server.crt key /etc/openvpn/easy-rsa/2.0/keys/server.key dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem user nobody group nogroup server 10.8.0.0 255.255.255.0 persist-key persist-tun #persist-local-ip status openvpn-status.log verb 3 client-to-client push "redirect-gateway def1" push "dhcp-option DNS 10.8.0.1" log-append /var/log/openvpn comp-lzo I searched all over the net for a solution and all answers seems to be related to the auth-nocache param which I haven't set. The directive auth-user-pass-verify /etc/openvpn/auth.pl via-env points to a script which is executed to perform the authentication. A false authentication should result in a exit 1 while a true one should result with exit 0. For testing, that script auth.pl returns exit 0 no matter what the input is but it seems that the file is not executed before the error raises. auth.pl file contents: #!/usr/bin/perl my $user = $ENV{username}; my $passwd = $ENV{password}; printf("$user : $passwd\n"); exit 0; Any ideas?

    Read the article

  • Login and Redirect

    - by xRobot
    This is my login views: def login(request): redirect_to = request.REQUEST.get("next") if request.method == 'POST': formL = LoginForm(data=request.POST) if formL.is_valid(): if not redirect_to or '//' in redirect_to or ' ' in redirect_to: redirect_to = "/blogs/" from django.contrib.auth import login login(request, formL.get_user()) if request.session.test_cookie_worked(): request.session.delete_test_cookie() return HttpResponseRedirect(redirect_to) else: formL = LoginForm(request) request.session.set_test_cookie() return render_to_response('blogs.html', { 'formL': formL, }, context_instance=RequestContext(request)) login = never_cache(login) When I go, for example, to example.com/myblog/ then I have been redirect to example.com/accounts/login/?next=/myblog/ but when I insert user and psw for login then I have been redirect to /blogs/ and not /myblog/ Why ?

    Read the article

  • Possible form field types per model field type

    - by Jonathan
    Django's documentation specifies for each model field type the corresponding default form field type. Alas, I couldn't find in the documentation, or anywhere else, what form field types are possible per model field type. Not all combinations are possible, right? Same question for widgets...

    Read the article

  • Locating file path from a <InMemoryUploadedFile> Djnago object

    - by PirosB3
    Hi all I have a Django app which, submitting a package, should return values that are inside it.. Submitted the form to a view called "insert": request.FILES['file'] returns the file objects, but it is of kind < InMemoryUploadedFile. What i need is a way to get the absolute path of the uploaded file, so that i can feed it to a method that will return the values needed Anyone know how i can accomplish this? Thanks

    Read the article

  • Could I use urlize filter in this way ?

    - by xRobot
    Could I use urlize filter in this way? : from django.utils.html import urlize def save(self, force_insert=False, force_update=False): self.body = urlize(self.body) super(Post, self).save(force_insert, force_update) body is a TextField.

    Read the article

  • Populating Models from other Models in Django?

    - by JT
    This is somewhat related to the question posed in this question but I'm trying to do this with an abstract base class. For the purposes of this example lets use these models: class Comic(models.Model): name = models.CharField(max_length=20) desc = models.CharField(max_length=100) volume = models.IntegerField() ... <50 other things that make up a Comic> class Meta: abstract = True class InkedComic(Comic): lines = models.IntegerField() class ColoredComic(Comic): colored = models.BooleanField(default=False) In the view lets say we get a reference to an InkedComic id since the tracer, err I mean, inker is done drawing the lines and it's time to add color. Once the view has added all the color we want to save a ColoredComic to the db. Obviously we could do inked = InkedComic.object.get(pk=ink_id) colored = ColoredComic() colored.name = inked.name etc, etc. But really it'd be nice to do: colored = ColoredComic(inked_comic=inked) colored.colored = True colored.save() I tried to do class ColoredComic(Comic): colored = models.BooleanField(default=False) def __init__(self, inked_comic = False, *args, **kwargs): super(ColoredComic, self).__init__(*args, **kwargs) if inked_comic: self.__dict__.update(inked_comic.__dict__) self.__dict__.update({'id': None}) # Remove pk field value but it turns out the ColoredComic.objects.get(pk=1) call sticks the pk into the inked_comic keyword, which is obviously not intended. (and actually results in a int does not have a dict exception) My brain is fried at this point, am I missing something obvious, or is there a better way to do this?

    Read the article

  • Assigning a group while adding user in django-admin

    - by Lokharkey
    In my application, I have models that have the Users model as a Foreign key, eg: class Doctor(models.Model): username=models.ForeignKey(User, unique=True) ... In the admin site, when adding a new Doctor, I have the option of adding a new User next to the username field. This is exactly what I want, but in the dialog that opens, it asks for a username and password for the new user; I would also like to be able to assign a group to this new user. What would be the best way of doing this ? Thanks, lokharkey

    Read the article

  • django deleting models and overriding delete method

    - by Mike
    I have 2 models class Vhost(models.Model): dns = models.ForeignKey(DNS) user = models.ForeignKey(User) extra = models.TextField() class ApplicationInstalled(models.Model): user = models.ForeignKey(User) added = models.DateTimeField(auto_now_add=True) app = models.ForeignKey(Application) ver = models.ForeignKey(ApplicationVersion) vhost = models.ForeignKey(Vhost) path = models.CharField(max_length=100, default="/") def delete(self): # # remove the files # print "need to remove some files" super(ApplicationInstalled, self).delete() If I do the following >>> vhost = Vhost.objects.get(id=10) >>> vhost.id 10L >>> ApplicationInstalled.objects.filter(vhost=vhost) [<ApplicationInstalled: http://wiki.jy.com/>] >>> vhost.delete() >>> ApplicationInstalled.objects.filter(vhost=vhost) [] As you can see there is an applicationinstalled object linked to vhost but when I delete the vhost, the applicationinstalled object is gone but the print never gets called. Any easy way to do this without iterating through the objects in the vhost delete?

    Read the article

  • Django disable editing (but allow adding) in TabularInline view

    - by VoteyDisciple
    I want to disable editing ALL objects within a particular TabularInline instance, while still allowing additions and while still allowing editing of the parent model. I have this trivial setup: class SuperviseeAdmin(admin.TabularInline): model = Supervisee class SupervisorAdmin(admin.ModelAdmin): inlines = [SuperviseeAdmin] admin.site.register(Supervisor, SupervisorAdmin) I have tried adding a has_change_permission function to SuperviseeAdmin that returns False unconditionally, but it had no effect. I have tried setting actions = None in SuperviseeAdmin but it had no effect. What might I be overlooking that could get this to work?

    Read the article

  • Django Admin: OneToOne Relation as an Inline?

    - by Jim Robert
    I am putting together the admin for a satchmo application. Satchmo uses OneToOne relations to extend the base Product model, and I'd like to edit it all on one page. It is possible to have a OneToOne relation as an Inline? If not, what is the best way to add a few fields to a given page of my admin that will eventually be saved into the OneToOne relation? for example: class Product(models.Model): name = models.CharField(max_length=100) ... class MyProduct(models.Model): product = models.OneToOne(Product) ... I tried this for my admin but it does not work, and seems to expect a Foreign Key: class ProductInline(admin.StackedInline): model = Product fields = ('name',) class MyProductAdmin(admin.ModelAdmin): inlines = (AlbumProductInline,) admin.site.register(MyProduct, MyProductAdmin) Which throws this error: <class 'satchmo.product.models.Product'> has no ForeignKey to <class 'my_app.models.MyProduct'> Is the only way to do this a Custom Form? edit: Just tried the following code to add the fields directly... also does not work: class AlbumAdmin(admin.ModelAdmin): fields = ('product__name',)

    Read the article

  • Good example usage of get_or _create in Django views and raising a Form error

    - by Rik Wade
    I would like to use get_or_create to check whether an object already exists in my database. If it does not, then it will be created. If it does exist, then I will not create the new object, but need to raise a form error to inform the user that they need to enter different data (for example, a different username). The view contains: p, created = Person.objects.get_or_create( email = registration_form.cleaned_data['email'], defaults = { 'creationDate': datetime.datetime.now(), 'dateOfBirth': datetime.date(1970,1,1) }) So 'p' will contain the existing Person if it exists, or the new Person if not. I would like to act on the boolean value in 'created' in order to skip over saving the Person and re-display the registration_form and raise an appropriate form validation error. The alternative I'm considering is doing a check in a custom Form validation method to see whether a Person exists with the data in the provided 'email' field, and just raising a validation error.

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >