Re: django-cache-machine with Redis

2014-04-24 Thread Ramón Carrillo
Oh, my mistake. I did miss the django-cache-machine part.

Anyway, from the sources it seems supported and dependant on
django-redis-cache [0,1]. So, you should installed first.

According to a commit message [0] and an example [2], this should be
in your settings.py:

CACHE_MACHINE_USE_REDIS = True
REDIS_BACKEND = 'redis://host:port?opt=val'

REDIS_BACKEND value should be parsable by django-redis-cache.

Have you tried this?

Bear in mind that the commit is rather old, and the REDIS_BACKEND
should be in a format intended for Django 1.3 [3]. Maybe, it's
undocumented because it doesn't work anymore.

[0] 
https://github.com/jbalogh/django-cache-machine/commit/c8af02142999629c561ec6a4ccd4268a621bd607
[1] 
https://github.com/jbalogh/django-cache-machine/blob/master/caching/invalidation.py
[2] 
https://github.com/jbalogh/django-cache-machine/blob/master/examples/cache_machine/redis_settings.py
[3] https://github.com/sebleier/django-redis-cache#usage

On Thu, Apr 24, 2014 at 12:20 PM, Mike Megally <cmsim...@gmail.com> wrote:
> Thanks! I got the redis cache set up. What is worrying me is that
> django-cache-machine says that you need to use one of its backends for
> caching and django-cache-machine doesn't come with one for redis. Just
> memcache and localmem. I'm wondering if its safe to just use the redis cache
> i've setup.
>
>
> On Thursday, April 24, 2014 9:30:49 AM UTC-7, Ramón Carrillo wrote:
>>
>> Hi Mike,
>>
>> You need a cache backend, you can write it by yourself [0] or use an
>> existing one [1,2]
>>
>> [0]
>> https://docs.djangoproject.com/en/1.6/topics/cache/#using-a-custom-cache-backend
>> [1] https://github.com/niwibe/django-redis
>> [2] https://github.com/sebleier/django-redis-cache
>>
>> On Wed, Apr 23, 2014 at 8:29 PM, Mike Megally <cmsi...@gmail.com> wrote:
>> > Did you figure this out? I'm currently in the same situation.
>> >
>> > On Thursday, March 28, 2013 9:56:13 PM UTC-7, Alan Johnson wrote:
>> >>
>> >> How does one configure this?  The documentation only explains how to
>> >> use
>> >> locmem or memcached, and yet the commit logs reference Redis multiple
>> >> times,
>> >> so it must be doable. Does anybody have any advice or experience with
>> >> this?
>> >
>> > --
>> > 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 http://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/django-users/e147c975-33e9-466d-81f0-8b3949330b18%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/86df6e91-edc8-425c-bb8d-204b46ef3cb7%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswhTRVohQQvroobQ4%2BKzAKe_ZNw5iEJAwUDkxj71A66ztA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-cache-machine with Redis

2014-04-24 Thread Ramón Carrillo
Hi Mike,

You need a cache backend, you can write it by yourself [0] or use an
existing one [1,2]

[0] 
https://docs.djangoproject.com/en/1.6/topics/cache/#using-a-custom-cache-backend
[1] https://github.com/niwibe/django-redis
[2] https://github.com/sebleier/django-redis-cache

On Wed, Apr 23, 2014 at 8:29 PM, Mike Megally  wrote:
> Did you figure this out? I'm currently in the same situation.
>
> On Thursday, March 28, 2013 9:56:13 PM UTC-7, Alan Johnson wrote:
>>
>> How does one configure this?  The documentation only explains how to use
>> locmem or memcached, and yet the commit logs reference Redis multiple times,
>> so it must be doable. Does anybody have any advice or experience with this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e147c975-33e9-466d-81f0-8b3949330b18%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswizD0fQV3FaQjZ3dW1ToHRFFxxY0WbKML1DjgLBmqEO2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin - editable list

2014-04-24 Thread Ramón Carrillo
Hi Radhika,

You mean this?
https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_editable

On Thu, Apr 24, 2014 at 10:52 AM, Radhika Srinivasan  wrote:
> Could you please update me on. How to create an admin-editable list
> [check-list] in django? Thank you, Rads
>
> Best regards,
> Radhika
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKgmSddXVbR9Sc__1tKdHtSGhsgtwkBg28%3DifXsvUQ7JO8ATfg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswhdoTiqbr9%2BuNptSMmN%2BDvqm5UB7Lt1vGSi0Mv86%2Bn-TA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: get user profile info in templates

2014-04-24 Thread Ramón Carrillo
Hi,

Did you set CustomUserAuth as your auth model in settings.py? [1]

[0] 
https://docs.djangoproject.com/en/1.6/ref/settings/#std:setting-AUTH_USER_MODEL

On Thu, Apr 24, 2014 at 3:41 AM, sourav  wrote:
> hi i am a newbie in django i am creating an app with customuser and profile
>
> i want get user profile information  in templates who is logged in.
> try everypossible solution but didn't achieve anything
>
> this is my profile models code below:
>
> from django.db import models
> from django.utils.translation import ugettext_lazy as _
>
> from CustomUserAuth.models import CustomUser
>
>
> class ProfileModel(models.Model):
> user = models.OneToOneField(CustomUser)
> avatar = models.ImageField(_('Profile Pic'),upload_to='images/')
> first_name = models.CharField(_('First Name'),max_length=100)
> last_name = models.CharField(_('Last Name'),max_length=100)
> company = models.CharField(_('Company'),max_length=100)
> title = models.CharField(_('Title'),max_length=100)
>
> def __str__(self):
> return '%s %s' % (self.first_name,self.last_name)
>
> def image_tag(self):
> return u'' % (self.avatar.url)
> image_tag.short_description = 'Image'
> image_tag.allow_tags = True
>
> CustomUser.profile = property(lambda u:
> ProfileModel.objects.get_or_create(user=u)[0])
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c4673b6c-f888-4fdb-8016-a6f2ece77568%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswjhNEwsLt1pcXzqw7AJB6DA7Qpp_FvKup%3DMxH9h4588Rg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django, mod_wsgi, apache and sharing media files (video) from a separate directory

2014-04-20 Thread Ramón Carrillo
Hi Adam,

>From your settings.py I guess the expanded url is something like
/PROYECTOS/file.xyz, right?

But, in your Apache alias your are serving the url /proyectos/ [0],
and urls are case sensitive unless you're using mod_speling [1].

I think "Alias /PROYECTOS/ /PROYECTOS/" should do the trick.

[0] http://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias
[1] http://httpd.apache.org/docs/2.4/mod/mod_speling.html

On Sun, Apr 20, 2014 at 9:19 AM, Adam Teale  wrote:
> Hi Guys,
>
>
> I am building a django app that runs out of my /Users/me/Dropbox directory.
>
>
> Localhost is pointed at my /Users/me/Sites directory.
>
>
> mod_wsgi installed.
>
> apache installed
>
> django installed and app working fine in development mode
>
>
> I am trying to embed media in a template
>
> This media comes from a directory outside of the django app - in the root of
> the machine - /PROYECTOS
>
>
> The permissions for the directories and preceding directories are readable
> by _www
>
>
> I think that I understand that
>
> - mod_wsgi will serve the dynamic files
>
> - apache will serve the static files like the css and template files, as
> well as the media files I am referencing in the /PROYECTOS directory
>
>
> I have the following in my settings.py:
>
> STATICFILES_DIRS = (os.path.join(BASE, "static"), )
>
> STATIC_URL = "/static/"
>
> MEDIA_URL = "/PROYECTOS/"
>
> WSGI_APPLICATION = 'mbrain.wsgi.application'
>
>
> In the /etc/apache2/extra/vhosts/localhost.conf I have:
>
>
> 
>
>
> DocumentRoot "/Users/me/Sites/localhost"
>
> ServerName localhost
>
>
> WSGIDaemonProcess localhost
> python-path=/Users/me/Dropbox/mBrain_Adam/mbrain/:/Users/me/Dropbox/mBrain_Adam/mbrain/venv/include/python2.7
>
> WSGIProcessGroup localhost
>
>
> Alias /proyectos/ /PROYECTOS/
>
>
> 
>
> Require all granted
>
> 
>
>
> WSGIScriptAlias / /Users/me/Dropbox/mBrain_Adam/mbrain/mbrain/wsgi.py
>
>
> 
>
> 
>
> Require all granted
>
> 
>
> 
>
>
> 
>
>
> So to embed a media file in a template I have this as the url:
>
> {{ MEDIA_URL }}{{ asset.assetPath }}
>
>
> When I load the page in a browser the console shows the fully expanded path
> for the media asset but with a 404 error - HTTP/1.1" 404 3045.
>
>
> I’d really appreciate any feedback on whether I am approaching this the
> right way or if I have completely missed the concept.
>
> Also any help on that 404 error would be appreciated.
>
>
> Cheers!
>
>
> Adam
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e6294564-01f1-449c-8cfb-e8dd474bda0b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswiPe%2BJqz58zG5uiBHA%2Bha6UOuMcaXMDj9acw36LAwk1Eg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: POST URL questions

2014-04-20 Thread Ramón Carrillo
Hi,

POST variables are appended to the HTTP request body instead of the URL [0].

If you want a variable to be available in the request.POST dictionary,
the browser must send it as a POST variable (in the request body). You
could use a hidden input to do it:





[0] 
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Sending_and_retrieving_form_data#The_method_attribute

On Sat, Apr 19, 2014 at 5:12 AM, nobody  wrote:
> Hi,
>
> I set up an URL when cliking a submit button, I got
> http://myhost.com/user/?userid=5987.
>
> In REQEST, I can get useid = request.GET['userid'], but in POST, I could not
> get the variable from the POST:
>
> if userid in request.POST
> userid = request.POST.get("userid", "")
>
> Despite the userid=5987 was included in the URL, the above check failed, how
> can I get variables in URL from POST? Also, not sure if the userid =
> request.POST.get("userid", "")
>  is the correct syntax to get variables from request.POST?
>
> Also, at the moment, I made a hard coded absolutely URL in the submit
> action:
>
> http://myhost.com/user/?userid={{
> request.user_id }}">{% csrf_token %}
>
> Is there a current URL I can put it in the action, for example, like action
> = "{{ current_url }}/?userid={{ request.user_id }}"?
>
> Thank you.
>
> Kind regards.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6438db49-a616-48b0-ae16-dfaa51a2f70f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswjjgKH53W2f_xtycqKM1%2BUSJufWFsm_dM%2BvbGDuJXo6gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about setting up my first app in django tutorial

2014-04-17 Thread Ramón Carrillo
The file is probably in the wrong directory or you're naming it incorrectly.

It must be project_name/app_name/admin.py

Maybe you're placing it in project_name/admin.py or
project_name/project_name/admin.py

On Thu, Apr 17, 2014 at 9:51 AM, Xiaofeng Feng  wrote:
> Yes.
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'TestApp',
> )
>
> The last line TestApp is my first app.
>
> On Thursday, April 17, 2014 8:24:12 AM UTC-4, Jorge Andrés Vergara Ebratt
> wrote:
>>
>> Did you register the app in settings.py?
>>
>>
>> 2014-04-16 23:03 GMT-05:00 Xiaofeng Feng :
>>>
>>> I am now trying to set up my first app using django tutorial. However, I
>>> was stuck at adding the poll app in part 2. I think I followed all the steps
>>> and it goes well before this question. After I change admin.py with
>>>
>>> from django.contrib import admin
>>> from polls.models import Poll
>>>
>>> admin.site.register(Poll)
>>>
>>> as the tutorial says. The admin website does not change at all. Does
>>> anybody know why this happens? 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/7bdb76f7-caf7-4c44-af6f-05f042494bed%40googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>> --
>> Jorge Andres Vergara Ebratt
>> #SoftwareDeveloper (Or at least trying to be)
>> @javebratt
>> facebook.com/javebratt
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/36c07290-ff33-4e3d-b142-26efd577c38c%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswgGnKKAO1ob%2B4qyPKVnz%2BvsTta%3Dq0CU6%2BcrWA0f70TXRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deferred reverse geo coding upon record save/update

2014-04-17 Thread Ramón Carrillo
Hi Subodh,

I would use use the same model as a queue.

Add a address field to the sensordata model, make it nullable
(null=True). Then write a custom django-admin command [0] that gets
all the records in sensordata with null address, make the request to
the geodecoder and save the result in the address field.

Let's say you name your command 'geodecode':
$ manage.py geodecode
will fill the address for all the sensordata records with null address.

If you're in a Unix environment, you could use cron [1] to run this
command every certain time.

[0] https://docs.djangoproject.com/en/1.6/howto/custom-management-commands/
[1] http://www.thegeekstuff.com/2011/07/cron-every-5-minutes/

Regards,
Ramón

On Thu, Apr 17, 2014 at 6:19 PM, Subodh Nijsure
 wrote:
> I have application where mobile devices are collecting data from
> sensors, and along with sensor reading they also save gps co-ordinates
> where the sensor data is taken. This is uploaded to web server using
> REST interface on django platform.
>
> But I am trying to figure out how do I reverse geo decode those
> lat/lang numbers to actual address using google reverse geo-coder
> APIs. I know I could do this in save method but that would make save
> operation slower. Is there some way I can queue these operations
> within django implementation so the save can proceed but queue up a
> job that will reverse geo-decode lat/long and update a record.
>
> Say:
>
> My REST api creates a new record in table sensordata, with lat, long
> of (10.1, -120.202) what I want to happen is new record for sensordata
> say unique id 1234 gets created. At the same time  job is queued
> somewhere that will update record #1234 that will reverse geo-decode
> 10.1,-120.202 to the street address.
>
> -Subodh
>
> -Subodh
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CALr9Q3ZtH_MKKRhddmmRrqW_LAe7nFB6dbQ06TfGO%2B1Fe_BFTA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswjrAYxQ1SiCfstWxCZf%3DBe5cj-LnW0W6Awuq-biaUO_0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Including Page Fragments

2014-04-17 Thread Ramón Carrillo
I guess you are not supposed to use spaces there.

IIRC spaces aren't allowed when using filters, neither  (e.g.
var|filter1 is ok, var | filter1 is not)

You could find the exact reason digging in the template compiler code.
https://github.com/django/django/blob/master/django/template/__init__.py
https://github.com/django/django/blob/master/django/template/base.py

Regards,
Ramon

On Wed, Apr 16, 2014 at 10:21 PM, Venkatraman S  wrote:
> Just saw a weird problem while including template fragments:
>
> Works :
>   {% include "page.html" with one_variable="1" %}
>
> Does not because of the space during the variable assignment :
>{% include "page.html" with one_variable = "1" %}
>
> Regards,
> Venkat
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN7tdFT-kAGYgw6nioN-JK4a8LSK1_jadx6u0J7fnSt7%2Bo6%3D5g%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABoKswjXdwxhiuUHsy_R8Vj28n5EzK%3D2gdS-HEMk0Xx5C8N_Wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't connect Django with SQL Anywhere 11 Database

2014-04-15 Thread Ramón Carrillo
Hi,

You should use exactly the same parameters from your test_sqlany.py in your 
DATABASES dictionary.

The sqlany-django documentation states that "(eg. ENG, which is required 
for client versions prior to v12.0.0)". In the DATABASES dictionary, you 
seem to misunderstand the ENG option with PORT.

Given this
sqlanydb.connect(uid='dba', pwd='sql', eng='django', dbn='django')

Your dictionary should be like this
DATABASES = {
   'default' : {
   'ENGINE': 'sqlany_django',
   'NAME': 'django',
   'USER': 'dba',
   'PASSWORD': 'sql',
   'OPTIONS': {'eng': 'django'}
   }
}

On Monday, April 14, 2014 12:29:41 AM UTC-5, Elio Gerson Clímaco Herrera 
wrote:
>
> Hi everybody...
>
>  
>
> I need connect *django *with *sql anywhere 11 database*, i follow the 
> instructions on the page "SQL Anywhere Django Driver" from github.
>
>  
>
> I created the database with this command
>
> C:\>dbinit -z UCA django.db --> (database created successful)
>
>  
>
> I started the Database Server with command
>
> C:\>dbsrv11 django.db  --> (database server started successful)
>
>  
>
> I created my project with
>
> C:\>django-admin.py startproject mysite (at this point all it's ok)
>
>  
>
> I edit the file mysite/mysite/settings.py and I changed the DATABASES 
> setting with this
>
>  
>
> DATABASES = {
>
> 'default': {
>
> 'ENGINE': 'sqlany_django',
>
> 'NAME': 'django',
>
> 'USER': 'dba',
>
> 'PASSWORD': 'sql',
>
> 'OPTIONS': {'eng': '2638'},
>
> 'HOST': 'django',
>
> 'PORT': '2638',
>
> }
>
> }
>
>  
>
> The problem is, when I want sync database using this command
>
>  
>
> c:/mysite>python manage.py syncdb
>
>  
>
>  I get *"Database server not found*" error.
>
>  
>
> Please help me, I don't know how resolve this problem
>
>  
>
> Even I test the connection with a file (test_sqlany.py) this file contents 
> following code
>
>  
>
> import sqlanydb
>
> conn = sqlanydb.connect(uid='dba', pwd='sql', eng='django', dbn='django')
>
> curs = conn.cursor()
>
> curs.execute("select 'Hello, world!'")
>
> print "SQL Anywhere says: %s" % curs.fetchone()
>
> curs.close()
>
> conn.close()
>
>  
>
> I, get get the expected output:
>
>  
>
> c:\>python test_sqlany.py
>
> SQL Anywhere says: Hello, world!
>
>  
>
> I have an environment for test with this caracteristics
>
> O.S.: Windows XP
>
> DB Engine: *SQL Anywhere 11 with EBF 3069*
>
> Python 2.7
>
> Django 1.6.1
>
> Setuptools installed
>
> PIP installed
>
> sqlanydb installed
>
> sqlany-django installed
>
>  
>
> *Sorry my english is very bad :)*
>
>  
>
> *Here is the complete text about this error*
>
>  
>
> Traceback (most recent call last):
>
>   File "manage.py", line 10, in 
>
> execute_from_command_line(sys.argv)
>
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py", 
> line 
>
> 399, in execute_from_command_line
>
> utility.execute()
>
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py", 
> line
>
> 392, in execute
>
> self.fetch_command(subcommand).run_from_argv(self.argv)
>
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", 
> line 242,
>
>  in run_from_argv
>
> self.execute(*args, **options.__dict__)
>
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", 
> line 285,
>
>  in execute
>
> output = self.handle(*args, **options)
>
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", 
> line 415,
>
>  in handle
>
> return self.handle_noargs(**options)
>
>   File 
> "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py"
>
> , line 57, in handle_noargs
>
> cursor = connection.cursor()
>
>   File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", 
> line 157,
>
>  in cursor
>
> cursor = self.make_debug_cursor(self._cursor())
>
>   File "C:\Python27\lib\site-packages\sqlany_django\base.py", line 476, in 
> _curs
>
> or
>
> self.connection = Database.connect(**kwargs)
>
>   File "C:\Python27\lib\site-packages\sqlanydb.py", line 459, in connect
>
> return Connection(args, kwargs)
>
>   File "C:\Python27\lib\site-packages\sqlanydb.py", line 508, in __init__
>
> self.handleerror(*error)
>
>   File "C:\Python27\lib\site-packages\sqlanydb.py", line 518, in 
> handleerror
>
> eh(self, None, errorclass, errorvalue)
>
>   File "C:\Python27\lib\site-packages\sqlanydb.py", line 340, in 
> standardErrorHa
>
> ndler
>
> raise errorclass(errorvalue)
>
> sqlanydb.OperationalError: *Database server not found*
>
>  
>
>  
>

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

Re: Autoupdate

2014-04-15 Thread Ramón Carrillo
Basically, you need to get the data from the server using Ajax, and then 
modify the DOM to show the received data to the user.

The easiest way I know is using jQuery, a JavaScript library that will 
spare you some headaches. The get  (or 
ajax ) methods should help you.

On Monday, April 14, 2014 8:57:43 AM UTC-5, Saransh Mehta wrote:
>
> Can you provide me with some links on how to do that?
>
> On Monday, April 14, 2014 5:59:24 PM UTC+5:30, Saransh Mehta wrote:
>>
>> I want some data to autoupdate on my homepage as more entries come into 
>> the database. It is more or less like the news feed feature of Facebook.
>> How do we do that?
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c01d2b2a-d42c-4094-bc45-5b3f75cd8f6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.