Re: extract data from MS SQL database

2015-09-14 Thread James Schneider
Are you talking about MySQL or Microsoft SQL Server?

If you Google Django and mssql, you'll see a few packages with varying
levels of support for particular Django versions and MS SQL.

-James
On Sep 14, 2015 9:45 PM, "Tom Lockhart"  wrote:

>
> > On Sep 14, 2015, at 21:12, sum abiut  wrote:
> >
> > Hi all,
> > Can someone please point me to right direction. I am trying to extract
> data from an existing  ms sql database. i just need some direction to get
> started.
>
> If you are trying to port your data from MySQL to Postgres, you may be
> able to use a combination of scripts available in Postgres and some alter
> table commands to get the datatypes to match up with what Django expects.
> Some columns will need to be converted by hand I would guess (e.g.
> date/time types?).
>
> If you are just trying to pull some data from some tables, you might find
> that using python is helpful (the library for Postgres is great for sucking
> in data; not sure about the feature set for the MySQL python library).
>
> hth
>
> - Tom
>
> --
> 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/54EC97DA-B170-4AC8-A939-62B1652294B6%40gmail.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/CA%2Be%2BciVGNHyiOriZg37N%3DqC0-TgKY9R5Xzu9wVQ3CN6mrorBLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: extract data from MS SQL database

2015-09-14 Thread Tom Lockhart

> On Sep 14, 2015, at 21:12, sum abiut  wrote:
> 
> Hi all,
> Can someone please point me to right direction. I am trying to extract data 
> from an existing  ms sql database. i just need some direction to get started.

If you are trying to port your data from MySQL to Postgres, you may be able to 
use a combination of scripts available in Postgres and some alter table 
commands to get the datatypes to match up with what Django expects. Some 
columns will need to be converted by hand I would guess (e.g. date/time types?).

If you are just trying to pull some data from some tables, you might find that 
using python is helpful (the library for Postgres is great for sucking in data; 
not sure about the feature set for the MySQL python library).

hth

- Tom

-- 
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/54EC97DA-B170-4AC8-A939-62B1652294B6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


extract data from MS SQL database

2015-09-14 Thread sum abiut
Hi all,
Can someone please point me to right direction. I am trying to extract data
from an existing  ms sql database. i just need some direction to get
started.

Cheers,
Sum

-- 
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/CAPCf-y5nOg57wKS2U8ev%2B6%2Be6OL-A-J05PNCAxU9JH6Dc44u6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: migration error "geo_db_type" when using postgres as second database for geodjango

2015-09-14 Thread Thomas Lockhart

On 9/14/15 7:10 PM, Wenyao Xue wrote:

Thanks, I guess I have to wait for 1.9 to release then

在 2015年9月15日星期二 UTC+8上午12:21:58,Tim Graham写道:

This is a bug that will be fixed in Django 1.9.


https://github.com/django/django/commit/0cc059cd104cdb70340bd08e597d403d80dc42a6



The fix seems to be fairly compact. Any chance of getting it into the 
1.8.x LTS branch?


- Tom


On Monday, September 14, 2015 at 7:35:15 AM UTC-4, Wenyao Xue wrote:

I upgraded my router using allow_migrate, but it didn't solve
my problem

在 2015年9月14日星期一 UTC+8下午6:37:56,Jani Tiainen写道:

I guess you need to write a bit more:


https://docs.djangoproject.com/en/1.8/topics/db/multi-db/#allow_migrate



And sync_db is deprecated...

On 14.09.2015 13:07, Wenyao Xue wrote:

Following is my router for world app.  No router for
other two apps, since default database is used
Settings:
DATABASE_ROUTERS = ['world.routers.GisRouter']

router.py in world app:
class GisRouter(object):
"""
A router to control all database operations on models
in the
auth application.
"""
def db_for_read(self, model, **hints):
if model._meta.app_label == 'world':
return 'geodjango'
return None

def db_for_write(self, model, **hints):
"""
Attempts to write auth models go to auth_db.
"""
if model._meta.app_label == 'world':
return 'geodjango'
return None

def allow_relation(self, obj1, obj2, **hints):
"""
Allow relations if a model in the auth app is
involved.
"""
if obj1._meta.app_label == 'world' or \
   obj2._meta.app_label == 'world':
   return True
return None

def allow_syncdb(self, db, model):
"""
Make sure the auth app only appears in the 'auth_db'
database.
"""
if db == 'geodjango':
return model._meta.app_label == 'world'
elif model._meta.app_label == 'world':
return False
return None

在 2015年9月14日星期一 UTC+8下午5:40:55,Jani Tiainen写道:



On 14.09.2015 11:58, Wenyao Xue wrote:

Hi,
I use mysql as default database and postgres for
geodjango related appliction.
my settings:
DATABASE_ROUTERS = ['world.routers.GisRouter',
'rest_shop.routers.ShopRouter',
'rest_client.routers.ClientRouter']

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'fddd',
'USER': **,
'PASSWORD': **,
'HOST': SERVER_HOST,
'PORT': '3306',
},
'geodjango': {
'ENGINE':
'django.contrib.gis.db.backends.postgis',
'NAME': 'geo',
'USER': *,
'PASSWORD': ***,
'HOST': SERVER_HOST,
}
}

during migration, error raised:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm
4.5.4\helpers\pycharm\django_manage.py", line 41, in

run_module(manage_file, None, '__main__', True)
  File "C:\Python27\lib\runpy.py", line 176, in
run_module
fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 82, in
_run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
  File "D:\src\fddd_backend\manage.py", line 10, in

execute_from_command_line(sys.argv)
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
line 338, in execute_from_command_line
utility.execute()
   

Re: migration error "geo_db_type" when using postgres as second database for geodjango

2015-09-14 Thread Wenyao Xue
Thanks, I guess I have to wait for 1.9 to release then

在 2015年9月15日星期二 UTC+8上午12:21:58,Tim Graham写道:
>
> This is a bug that will be fixed in Django 1.9.
>
>
> https://github.com/django/django/commit/0cc059cd104cdb70340bd08e597d403d80dc42a6
>
> On Monday, September 14, 2015 at 7:35:15 AM UTC-4, Wenyao Xue wrote:
>>
>> I upgraded my router using allow_migrate, but it didn't solve my problem
>>
>> 在 2015年9月14日星期一 UTC+8下午6:37:56,Jani Tiainen写道:
>>>
>>> I guess you need to write a bit more:
>>>
>>> https://docs.djangoproject.com/en/1.8/topics/db/multi-db/#allow_migrate
>>>
>>> And sync_db is deprecated...
>>>
>>> On 14.09.2015 13:07, Wenyao Xue wrote:
>>>
>>> Following is my router for world app.  No router for other two apps, 
>>> since default database is used 
>>> Settings:
>>> DATABASE_ROUTERS = ['world.routers.GisRouter']
>>>
>>> router.py in world app:
>>> class GisRouter(object):
>>> """
>>> A router to control all database operations on models in the
>>> auth application.
>>> """
>>> def db_for_read(self, model, **hints):
>>> if model._meta.app_label == 'world':
>>> return 'geodjango'
>>> return None
>>>
>>> def db_for_write(self, model, **hints):
>>> """
>>> Attempts to write auth models go to auth_db.
>>> """
>>> if model._meta.app_label == 'world':
>>> return 'geodjango'
>>> return None
>>>
>>> def allow_relation(self, obj1, obj2, **hints):
>>> """
>>> Allow relations if a model in the auth app is involved.
>>> """
>>> if obj1._meta.app_label == 'world' or \
>>>obj2._meta.app_label == 'world':
>>>return True
>>> return None
>>>
>>> def allow_syncdb(self, db, model):
>>> """
>>> Make sure the auth app only appears in the 'auth_db'
>>> database.
>>> """
>>> if db == 'geodjango':
>>> return model._meta.app_label == 'world'
>>> elif model._meta.app_label == 'world':
>>> return False
>>> return None
>>>
>>> 在 2015年9月14日星期一 UTC+8下午5:40:55,Jani Tiainen写道: 



 On 14.09.2015 11:58, Wenyao Xue wrote:

 Hi,  
 I use mysql as default database and postgres for geodjango related 
 appliction.  
 
 my settings:
 DATABASE_ROUTERS = ['world.routers.GisRouter',
 'rest_shop.routers.ShopRouter',
 'rest_client.routers.ClientRouter']

 DATABASES = {
 'default': {
 'ENGINE': 'django.db.backends.mysql',
 'NAME': 'fddd',
 'USER': **,
 'PASSWORD': **,
 'HOST': SERVER_HOST,
 'PORT': '3306',
 },
 'geodjango': {
 'ENGINE': 'django.contrib.gis.db.backends.postgis',
 'NAME': 'geo',
 'USER': *,
 'PASSWORD': ***,
 'HOST': SERVER_HOST,
 }
 }

 during migration, error raised:

 Traceback (most recent call last):
   File "C:\Program Files (x86)\JetBrains\PyCharm 
 4.5.4\helpers\pycharm\django_manage.py", line 41, in 
 run_module(manage_file, None, '__main__', True)
   File "C:\Python27\lib\runpy.py", line 176, in run_module
 fname, loader, pkg_name)
   File "C:\Python27\lib\runpy.py", line 82, in _run_module_code
 mod_name, mod_fname, mod_loader, pkg_name)
   File "C:\Python27\lib\runpy.py", line 72, in _run_code
 exec code in run_globals
   File "D:\src\fddd_backend\manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File 
 "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
  
 line 338, in execute_from_command_line
 utility.execute()
   File 
 "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
  
 line 330, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File 
 "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
  
 line 393, in run_from_argv
 self.execute(*args, **cmd_options)
   File 
 "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
  
 line 443, in execute
 self.check()
   File 
 "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
  
 line 481, in check
 include_deployment_checks=include_deployment_checks,
   File 
 "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\registry.py",
  
 line 72, in run_checks
 new_errors = check(app_configs=app_configs)
   File 
 "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\model_checks.py",
  
 line 28, in check_all_models
 

Django split pane with highlighting

2015-09-14 Thread Arnab Banerji
Hi all - here is what I am trying to achieve - I need a split pane view 
with the following contents: 

(1) the right half will contain a bunch of links, 

(2) the left half will be one long static document

Depending on which link is clicked on the right hand side, I want the 
appropriate section of the document on the left hand side highlighted.

What is the best combination of libraries that can help me achieve this?

Thanks a ton,
-AB

-- 
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/96394e10-a0e1-43f6-8798-d82e252e5953%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: access django admin got error 500

2015-09-14 Thread erik freaks
I got this exception value
"no such column : django_content_type.name"

in this debug show that I'm using django 1.7.6, but when I check to my
virtualenv django version is 1.8


On Fri, Sep 11, 2015 at 2:55 PM, asarkar1...@gmail.com <
asarkar1...@gmail.com> wrote:

> Where are you hosting this web site ?
>
> Sent from my HTC
>
> - Reply message -
> From: "erik freaks" 
> To: 
> Subject: access django admin got error 500
> Date: Fri, Sep 11, 2015 8:29 AM
>
>
> Hi, I'm new in django, I had create simple website using django and deploy
> it to apache server, but when I try to access admin page I got error 500..
>
> please someone with experience with django+apache help me..
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAG0MBoFus7EgFE2jzKm1zVNaL%3DJoJ%2BZYpS7YxCHFtYp0TdbaA%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/55f288fa.89fb420a.31417.191b%40mx.google.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/CAAG0MBriaQmVH6GtqeFjHRa0ZjBRZ0O2m7rsHksnhBAdzf_06A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Advanced Annotate

2015-09-14 Thread Paolo C.


I've posted this 
 
issue on Stackoverflow

Given this model:

from django.db import models


class Post(models.Model):
text = models.CharField(max_length=255)


class Comment(models.Model):
text = models.CharField(max_length=255)
needs_attention = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
post = models.ForeignKey(Post)

I can annotate the list of posts with:

Post.objects.annotate(last_comment_date=Max('comment__created_at'))

to know the last_comment_date, how to annotate to set a value for 
last_comment_needs_attention?

How can obtain details from the last comment when listing ll posts?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/767682ba-7b96-464e-b2b2-b0ff82fbd320%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTPS instead of HTTP in view

2015-09-14 Thread James Schneider
To clarify, are you running this on a full web server such as Apache? If
so, do you have directives in the webserver configuration that are handling
the redirection to HTTPS? Or are you using the built-in runserver?

The built-in runserver has no support for HTTPS. Do you have any 3rd party
packages installed in settings.py that may introduce middleware that would
redirect to HTTPS?

-James

On Mon, Sep 14, 2015 at 12:34 PM, Hugo Kitano  wrote:

> This is my settings.py, but I've commented out all the code I added
>
> --
> 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/3c1535df-ff18-4587-97d6-9f95a53a5f76%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/CA%2Be%2BciVizDKccKVbu-qeTQttQG-pmYmcDx5APdqXZq_PAqy1LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTPS instead of HTTP in view

2015-09-14 Thread Hugo Kitano
This is my settings.py, but I've commented out all the code I added 

-- 
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/3c1535df-ff18-4587-97d6-9f95a53a5f76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


HTTPS instead of HTTP in view

2015-09-14 Thread Hugo Kitano
Only one view in my project uses HTTPS instead of HTTP, now, after me 
fooling around with SSL's and cookies and such.
My view for that project is simple enough that it isn't the problem

It's the home page of the project.  Any ideas for why only one view uses 
HTTPS? I can't use the view in runserver anymore now.


-- 
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/054e5b17-6cc5-49e1-b97e-557510616a71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: http://stackoverflow.com/questions/32549006/how-to-automatically-save-the-headline-for-every-new-article-provided-my-3rd-par

2015-09-14 Thread Daniel Roseman
On Monday, 14 September 2015 08:35:42 UTC+1, n00b wrote:
>
>
> http://stackoverflow.com/questions/32549006/how-to-automatically-save-the-headline-for-every-new-article-provided-my-3rd-par
>

Yes, that is a link. Congratulations.
--
DR. 

-- 
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/f581a8e3-eb13-4f87-8912-158acb129329%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get Label alignment to top of TextField in form

2015-09-14 Thread Dmitry Homenok
Hey Mike,

Believe, you have to check the following methods of BaseForm class:
 - as_p
 - as_table
 - as_ul

There you'll find templates for html output.

- Dmitry


On Monday, September 14, 2015 at 1:07:45 AM UTC+3, Mike wrote:
>
> Hi,
> I have TextField in model. 
> story = models.TextField()
>
> When it shows up in form label is aligned down beside big Textarea.
> Label should align top beside Textarea in order to get user see it first.
>
> How to implement it so?
>
> Thanks for help 
> - be ginner
>

-- 
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/48bd6bf6-2945-4696-a6cd-51bcd17abbf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 1.8 , makemigrations throwing errors

2015-09-14 Thread ernando
Hey John,

Agree with James. makemigrations command doesn't create models.py file - 
it's on your plate. But after creating models.py file and filling it with 
your models - you have to create migration file with makemigrations command 
and run migrate one to create all required tables, fk, etc.

- Dmitry

On Friday, September 11, 2015 at 10:42:03 PM UTC+3, John Emmatty wrote:
>
> I ran makemigrations against my legacy, MySQL database and it created 
> models.py file for me, I copied the file to my applications package 
> directory and ran makemigrations again after adding a table to extend the 
> default users table. Now makemigrations is throwing following errors . I 
> created a fresh django project which had no reference to older versions.
>
> SystemCheckError: System check identified some issues:
>
> ERRORS:
> djangogettrix.AuthGroupPermissions: (models.E012) 'unique_together' 
> refers to the non-existent field 'group_id'.
> djangogettrix.AuthGroupPermissions: (models.E012) 'unique_together' 
> refers to the non-existent field 'permission_id'.
> djangogettrix.AuthPermission: (models.E012) 'unique_together' refers 
> to the non-existent field 'content_type_id'.
> djangogettrix.AuthUserGroups: (models.E012) 'unique_together' refers 
> to the non-existent field 'group_id'.
> djangogettrix.AuthUserGroups: (models.E012) 'unique_together' refers 
> to the non-existent field 'user_id'.
> djangogettrix.AuthUserUserPermissions: (models.E012) 'unique_together' 
> refers to the non-existent field 'permission_id'.
> djangogettrix.AuthUserUserPermissions: (models.E012) 'unique_together' 
> refers to the non-existent field 'user_id'.
> djangogettrix.RolesUsers: (models.E012) 'unique_together' refers to 
> the non-existent field 'role_id'.
> djangogettrix.RolesUsers: (models.E012) 'unique_together' refers to 
> the non-existent field 'user_id'.
>
> Kindly help me by throwing some light on 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/6dc83113-677e-4499-b3df-2b12a1efae1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django distributed memcached handling when server in cluster goes offline

2015-09-14 Thread LiteWait
I've got Django/memcached running in a 4 web server configuration on AWS. 
 In settings.py each web server has (of course) a list of all the IPs 
participating in the memcached cluster.  What I am noticing is when a 
server goes offline, all requests slow to a complete crawl presumably 
because Django/memcached is attempting to reference keys that has to the 
server that is down and is timing out.

Is this expected behavior?  If so how are others handling this?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f8df76ae-6029-4dad-980c-06c4e93b4173%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: migration error "geo_db_type" when using postgres as second database for geodjango

2015-09-14 Thread Tim Graham
This is a bug that will be fixed in Django 1.9.

https://github.com/django/django/commit/0cc059cd104cdb70340bd08e597d403d80dc42a6

On Monday, September 14, 2015 at 7:35:15 AM UTC-4, Wenyao Xue wrote:
>
> I upgraded my router using allow_migrate, but it didn't solve my problem
>
> 在 2015年9月14日星期一 UTC+8下午6:37:56,Jani Tiainen写道:
>>
>> I guess you need to write a bit more:
>>
>> https://docs.djangoproject.com/en/1.8/topics/db/multi-db/#allow_migrate
>>
>> And sync_db is deprecated...
>>
>> On 14.09.2015 13:07, Wenyao Xue wrote:
>>
>> Following is my router for world app.  No router for other two apps, 
>> since default database is used 
>> Settings:
>> DATABASE_ROUTERS = ['world.routers.GisRouter']
>>
>> router.py in world app:
>> class GisRouter(object):
>> """
>> A router to control all database operations on models in the
>> auth application.
>> """
>> def db_for_read(self, model, **hints):
>> if model._meta.app_label == 'world':
>> return 'geodjango'
>> return None
>>
>> def db_for_write(self, model, **hints):
>> """
>> Attempts to write auth models go to auth_db.
>> """
>> if model._meta.app_label == 'world':
>> return 'geodjango'
>> return None
>>
>> def allow_relation(self, obj1, obj2, **hints):
>> """
>> Allow relations if a model in the auth app is involved.
>> """
>> if obj1._meta.app_label == 'world' or \
>>obj2._meta.app_label == 'world':
>>return True
>> return None
>>
>> def allow_syncdb(self, db, model):
>> """
>> Make sure the auth app only appears in the 'auth_db'
>> database.
>> """
>> if db == 'geodjango':
>> return model._meta.app_label == 'world'
>> elif model._meta.app_label == 'world':
>> return False
>> return None
>>
>> 在 2015年9月14日星期一 UTC+8下午5:40:55,Jani Tiainen写道: 
>>>
>>>
>>>
>>> On 14.09.2015 11:58, Wenyao Xue wrote:
>>>
>>> Hi,  
>>> I use mysql as default database and postgres for geodjango related 
>>> appliction.  
>>> 
>>> my settings:
>>> DATABASE_ROUTERS = ['world.routers.GisRouter',
>>> 'rest_shop.routers.ShopRouter',
>>> 'rest_client.routers.ClientRouter']
>>>
>>> DATABASES = {
>>> 'default': {
>>> 'ENGINE': 'django.db.backends.mysql',
>>> 'NAME': 'fddd',
>>> 'USER': **,
>>> 'PASSWORD': **,
>>> 'HOST': SERVER_HOST,
>>> 'PORT': '3306',
>>> },
>>> 'geodjango': {
>>> 'ENGINE': 'django.contrib.gis.db.backends.postgis',
>>> 'NAME': 'geo',
>>> 'USER': *,
>>> 'PASSWORD': ***,
>>> 'HOST': SERVER_HOST,
>>> }
>>> }
>>>
>>> during migration, error raised:
>>>
>>> Traceback (most recent call last):
>>>   File "C:\Program Files (x86)\JetBrains\PyCharm 
>>> 4.5.4\helpers\pycharm\django_manage.py", line 41, in 
>>> run_module(manage_file, None, '__main__', True)
>>>   File "C:\Python27\lib\runpy.py", line 176, in run_module
>>> fname, loader, pkg_name)
>>>   File "C:\Python27\lib\runpy.py", line 82, in _run_module_code
>>> mod_name, mod_fname, mod_loader, pkg_name)
>>>   File "C:\Python27\lib\runpy.py", line 72, in _run_code
>>> exec code in run_globals
>>>   File "D:\src\fddd_backend\manage.py", line 10, in 
>>> execute_from_command_line(sys.argv)
>>>   File 
>>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
>>>  
>>> line 338, in execute_from_command_line
>>> utility.execute()
>>>   File 
>>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
>>>  
>>> line 330, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File 
>>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>>>  
>>> line 393, in run_from_argv
>>> self.execute(*args, **cmd_options)
>>>   File 
>>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>>>  
>>> line 443, in execute
>>> self.check()
>>>   File 
>>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>>>  
>>> line 481, in check
>>> include_deployment_checks=include_deployment_checks,
>>>   File 
>>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\registry.py",
>>>  
>>> line 72, in run_checks
>>> new_errors = check(app_configs=app_configs)
>>>   File 
>>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\model_checks.py",
>>>  
>>> line 28, in check_all_models
>>> errors.extend(model.check(**kwargs))
>>>   File 
>>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
>>>  
>>> line 1205, in check
>>> errors.extend(cls._check_fields(**kwargs))
>>>   File 
>>> 

Re: App tables are created in db_1 but requests are routed to db_2.

2015-09-14 Thread Larry Martell
On Mon, Sep 14, 2015 at 6:58 AM, Alan Kavanagh  wrote:
> I'm not sure why the tables are created in the other database. Can anyone
> offer insight how I could solve this issue?

We would need more info to know. What does your settings file look
like. How were the tables created? What the code that handles the
requests look like? What version of django are you using?

-- 
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/CACwCsY74WLi5Xnd2fjKw7%2BmZadU41BYTf_OCdSZ%2BBt3NapfZew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: real time notification system

2015-09-14 Thread Jani Tiainen
There are several ways to do that but something like Twisted and 
Websockets or NodeJS and Websockets could do the trick. There also 
exists swampdragon project that is supposed to have all the goodies in 
easy to use format.



On 14.09.2015 14:20, shamila ali wrote:
How can implement real time notification system in django project.I 
need a notification system like facebook.

--
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/2be15881-6b6a-4346-b407-d731c7e81536%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/55F6B2D2.9040802%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: migration error "geo_db_type" when using postgres as second database for geodjango

2015-09-14 Thread Wenyao Xue
I upgraded my router using allow_migrate, but it didn't solve my problem

在 2015年9月14日星期一 UTC+8下午6:37:56,Jani Tiainen写道:
>
> I guess you need to write a bit more:
>
> https://docs.djangoproject.com/en/1.8/topics/db/multi-db/#allow_migrate
>
> And sync_db is deprecated...
>
> On 14.09.2015 13:07, Wenyao Xue wrote:
>
> Following is my router for world app.  No router for other two apps, since 
> default database is used 
> Settings:
> DATABASE_ROUTERS = ['world.routers.GisRouter']
>
> router.py in world app:
> class GisRouter(object):
> """
> A router to control all database operations on models in the
> auth application.
> """
> def db_for_read(self, model, **hints):
> if model._meta.app_label == 'world':
> return 'geodjango'
> return None
>
> def db_for_write(self, model, **hints):
> """
> Attempts to write auth models go to auth_db.
> """
> if model._meta.app_label == 'world':
> return 'geodjango'
> return None
>
> def allow_relation(self, obj1, obj2, **hints):
> """
> Allow relations if a model in the auth app is involved.
> """
> if obj1._meta.app_label == 'world' or \
>obj2._meta.app_label == 'world':
>return True
> return None
>
> def allow_syncdb(self, db, model):
> """
> Make sure the auth app only appears in the 'auth_db'
> database.
> """
> if db == 'geodjango':
> return model._meta.app_label == 'world'
> elif model._meta.app_label == 'world':
> return False
> return None
>
> 在 2015年9月14日星期一 UTC+8下午5:40:55,Jani Tiainen写道: 
>>
>>
>>
>> On 14.09.2015 11:58, Wenyao Xue wrote:
>>
>> Hi,  
>> I use mysql as default database and postgres for geodjango related 
>> appliction.  
>> 
>> my settings:
>> DATABASE_ROUTERS = ['world.routers.GisRouter',
>> 'rest_shop.routers.ShopRouter',
>> 'rest_client.routers.ClientRouter']
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.mysql',
>> 'NAME': 'fddd',
>> 'USER': **,
>> 'PASSWORD': **,
>> 'HOST': SERVER_HOST,
>> 'PORT': '3306',
>> },
>> 'geodjango': {
>> 'ENGINE': 'django.contrib.gis.db.backends.postgis',
>> 'NAME': 'geo',
>> 'USER': *,
>> 'PASSWORD': ***,
>> 'HOST': SERVER_HOST,
>> }
>> }
>>
>> during migration, error raised:
>>
>> Traceback (most recent call last):
>>   File "C:\Program Files (x86)\JetBrains\PyCharm 
>> 4.5.4\helpers\pycharm\django_manage.py", line 41, in 
>> run_module(manage_file, None, '__main__', True)
>>   File "C:\Python27\lib\runpy.py", line 176, in run_module
>> fname, loader, pkg_name)
>>   File "C:\Python27\lib\runpy.py", line 82, in _run_module_code
>> mod_name, mod_fname, mod_loader, pkg_name)
>>   File "C:\Python27\lib\runpy.py", line 72, in _run_code
>> exec code in run_globals
>>   File "D:\src\fddd_backend\manage.py", line 10, in 
>> execute_from_command_line(sys.argv)
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
>>  
>> line 338, in execute_from_command_line
>> utility.execute()
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
>>  
>> line 330, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>>  
>> line 393, in run_from_argv
>> self.execute(*args, **cmd_options)
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>>  
>> line 443, in execute
>> self.check()
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>>  
>> line 481, in check
>> include_deployment_checks=include_deployment_checks,
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\registry.py",
>>  
>> line 72, in run_checks
>> new_errors = check(app_configs=app_configs)
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\model_checks.py",
>>  
>> line 28, in check_all_models
>> errors.extend(model.check(**kwargs))
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
>>  
>> line 1205, in check
>> errors.extend(cls._check_fields(**kwargs))
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
>>  
>> line 1282, in _check_fields
>> errors.extend(field.check(**kwargs))
>>   File 
>> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py",
>>  
>> line 207, in check
>> errors.extend(self._check_backend_specific_checks(**kwargs))
>>   File 
>> 

real time notification system

2015-09-14 Thread shamila ali
How can implement real time notification system in django project.I need a 
notification system like facebook.

-- 
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/2be15881-6b6a-4346-b407-d731c7e81536%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


App tables are created in db_1 but requests are routed to db_2.

2015-09-14 Thread Alan Kavanagh
I'm not sure why the tables are created in the other database. Can anyone 
offer insight how I could solve this issue? 

-- 
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/8dc605ae-dd91-4d56-9ed2-f11e69023798%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: migration error "geo_db_type" when using postgres as second database for geodjango

2015-09-14 Thread Jani Tiainen

I guess you need to write a bit more:

https://docs.djangoproject.com/en/1.8/topics/db/multi-db/#allow_migrate

And sync_db is deprecated...

On 14.09.2015 13:07, Wenyao Xue wrote:
Following is my router for world app.  No router for other two apps, 
since default database is used

Settings:
DATABASE_ROUTERS = ['world.routers.GisRouter']

router.py in world app:
class GisRouter(object):
"""
A router to control all database operations on models in the
auth application.
"""
def db_for_read(self, model, **hints):
if model._meta.app_label == 'world':
return 'geodjango'
return None

def db_for_write(self, model, **hints):
"""
Attempts to write auth models go to auth_db.
"""
if model._meta.app_label == 'world':
return 'geodjango'
return None

def allow_relation(self, obj1, obj2, **hints):
"""
Allow relations if a model in the auth app is involved.
"""
if obj1._meta.app_label == 'world' or \
   obj2._meta.app_label == 'world':
   return True
return None

def allow_syncdb(self, db, model):
"""
Make sure the auth app only appears in the 'auth_db'
database.
"""
if db == 'geodjango':
return model._meta.app_label == 'world'
elif model._meta.app_label == 'world':
return False
return None

在 2015年9月14日星期一 UTC+8下午5:40:55,Jani Tiainen写道:



On 14.09.2015 11:58, Wenyao Xue wrote:

Hi,
I use mysql as default database and postgres for geodjango
related appliction.
my settings:
DATABASE_ROUTERS = ['world.routers.GisRouter',
'rest_shop.routers.ShopRouter',
'rest_client.routers.ClientRouter']

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'fddd',
'USER': **,
'PASSWORD': **,
'HOST': SERVER_HOST,
'PORT': '3306',
},
'geodjango': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geo',
'USER': *,
'PASSWORD': ***,
'HOST': SERVER_HOST,
}
}

during migration, error raised:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm
4.5.4\helpers\pycharm\django_manage.py", line 41, in 
run_module(manage_file, None, '__main__', True)
  File "C:\Python27\lib\runpy.py", line 176, in run_module
fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
  File "D:\src\fddd_backend\manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
line 338, in execute_from_command_line
utility.execute()
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
line 393, in run_from_argv
self.execute(*args, **cmd_options)
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
line 443, in execute
self.check()
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
line 481, in check
include_deployment_checks=include_deployment_checks,
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\registry.py",
line 72, in run_checks
new_errors = check(app_configs=app_configs)
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\model_checks.py",
line 28, in check_all_models
errors.extend(model.check(**kwargs))
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
line 1205, in check
errors.extend(cls._check_fields(**kwargs))
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
line 1282, in _check_fields
errors.extend(field.check(**kwargs))
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py",
line 207, in check
errors.extend(self._check_backend_specific_checks(**kwargs))
  File

"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py",
line 306, in _check_backend_specific_checks
return connection.validation.check_field(self, **kwargs)



  File


Re: migration error "geo_db_type" when using postgres as second database for geodjango

2015-09-14 Thread Wenyao Xue
Following is my router for world app.  No router for other two apps, since 
default database is used
Settings:
DATABASE_ROUTERS = ['world.routers.GisRouter']

router.py in world app:
class GisRouter(object):
"""
A router to control all database operations on models in the
auth application.
"""
def db_for_read(self, model, **hints):
if model._meta.app_label == 'world':
return 'geodjango'
return None

def db_for_write(self, model, **hints):
"""
Attempts to write auth models go to auth_db.
"""
if model._meta.app_label == 'world':
return 'geodjango'
return None

def allow_relation(self, obj1, obj2, **hints):
"""
Allow relations if a model in the auth app is involved.
"""
if obj1._meta.app_label == 'world' or \
   obj2._meta.app_label == 'world':
   return True
return None

def allow_syncdb(self, db, model):
"""
Make sure the auth app only appears in the 'auth_db'
database.
"""
if db == 'geodjango':
return model._meta.app_label == 'world'
elif model._meta.app_label == 'world':
return False
return None

在 2015年9月14日星期一 UTC+8下午5:40:55,Jani Tiainen写道:
>
>
>
> On 14.09.2015 11:58, Wenyao Xue wrote:
>
> Hi,  
> I use mysql as default database and postgres for geodjango related 
> appliction.  
> 
> my settings:
> DATABASE_ROUTERS = ['world.routers.GisRouter',
> 'rest_shop.routers.ShopRouter',
> 'rest_client.routers.ClientRouter']
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql',
> 'NAME': 'fddd',
> 'USER': **,
> 'PASSWORD': **,
> 'HOST': SERVER_HOST,
> 'PORT': '3306',
> },
> 'geodjango': {
> 'ENGINE': 'django.contrib.gis.db.backends.postgis',
> 'NAME': 'geo',
> 'USER': *,
> 'PASSWORD': ***,
> 'HOST': SERVER_HOST,
> }
> }
>
> during migration, error raised:
>
> Traceback (most recent call last):
>   File "C:\Program Files (x86)\JetBrains\PyCharm 
> 4.5.4\helpers\pycharm\django_manage.py", line 41, in 
> run_module(manage_file, None, '__main__', True)
>   File "C:\Python27\lib\runpy.py", line 176, in run_module
> fname, loader, pkg_name)
>   File "C:\Python27\lib\runpy.py", line 82, in _run_module_code
> mod_name, mod_fname, mod_loader, pkg_name)
>   File "C:\Python27\lib\runpy.py", line 72, in _run_code
> exec code in run_globals
>   File "D:\src\fddd_backend\manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
>  
> line 338, in execute_from_command_line
> utility.execute()
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
>  
> line 330, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>  
> line 393, in run_from_argv
> self.execute(*args, **cmd_options)
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>  
> line 443, in execute
> self.check()
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
>  
> line 481, in check
> include_deployment_checks=include_deployment_checks,
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\registry.py",
>  
> line 72, in run_checks
> new_errors = check(app_configs=app_configs)
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\model_checks.py",
>  
> line 28, in check_all_models
> errors.extend(model.check(**kwargs))
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
>  
> line 1205, in check
> errors.extend(cls._check_fields(**kwargs))
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
>  
> line 1282, in _check_fields
> errors.extend(field.check(**kwargs))
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py",
>  
> line 207, in check
> errors.extend(self._check_backend_specific_checks(**kwargs))
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py",
>  
> line 306, in _check_backend_specific_checks
> return connection.validation.check_field(self, **kwargs)
>
>
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\backends\mysql\validation.py",
>  
> line 18, in check_field
> field_type = field.db_type(connection)
>   File 
> "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\contrib\gis\db\models\fields.py",
>  
> line 247, in 

Re: migration error "geo_db_type" when using postgres as second database for geodjango

2015-09-14 Thread Jani Tiainen



On 14.09.2015 11:58, Wenyao Xue wrote:

Hi,
I use mysql as default database and postgres for geodjango related 
appliction.

my settings:
DATABASE_ROUTERS = ['world.routers.GisRouter',
'rest_shop.routers.ShopRouter',
'rest_client.routers.ClientRouter']

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'fddd',
'USER': **,
'PASSWORD': **,
'HOST': SERVER_HOST,
'PORT': '3306',
},
'geodjango': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geo',
'USER': *,
'PASSWORD': ***,
'HOST': SERVER_HOST,
}
}

during migration, error raised:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 
4.5.4\helpers\pycharm\django_manage.py", line 41, in 

run_module(manage_file, None, '__main__', True)
  File "C:\Python27\lib\runpy.py", line 176, in run_module
fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
  File "D:\src\fddd_backend\manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py", 
line 338, in execute_from_command_line

utility.execute()
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py", 
line 330, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py", 
line 393, in run_from_argv

self.execute(*args, **cmd_options)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py", 
line 443, in execute

self.check()
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py", 
line 481, in check

include_deployment_checks=include_deployment_checks,
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\registry.py", 
line 72, in run_checks

new_errors = check(app_configs=app_configs)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\model_checks.py", 
line 28, in check_all_models

errors.extend(model.check(**kwargs))
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py", 
line 1205, in check

errors.extend(cls._check_fields(**kwargs))
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py", 
line 1282, in _check_fields

errors.extend(field.check(**kwargs))
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py", 
line 207, in check

errors.extend(self._check_backend_specific_checks(**kwargs))
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py", 
line 306, in _check_backend_specific_checks

return connection.validation.check_field(self, **kwargs)


  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\backends\mysql\validation.py", 
line 18, in check_field

field_type = field.db_type(connection)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\contrib\gis\db\models\fields.py", 
line 247, in db_type

return connection.ops.geo_db_type(self)
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'



Here it looks like Django is trying to validate something spatially 
related in you MySQL db and thus creating rather spurious error.


Do you have proper routing for migrations?



Is there something wrong with my settings?
--
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/3fa379ce-170f-48a3-911c-c8db168c6d53%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 

migration error "geo_db_type" when using postgres as second database for geodjango

2015-09-14 Thread Wenyao Xue
Hi, 
I use mysql as default database and postgres for geodjango related 
appliction.  

my settings:
DATABASE_ROUTERS = ['world.routers.GisRouter',
'rest_shop.routers.ShopRouter',
'rest_client.routers.ClientRouter']

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'fddd',
'USER': **,
'PASSWORD': **,
'HOST': SERVER_HOST,
'PORT': '3306',
},
'geodjango': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geo',
'USER': *,
'PASSWORD': ***,
'HOST': SERVER_HOST,
}
}

during migration, error raised:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 
4.5.4\helpers\pycharm\django_manage.py", line 41, in 
run_module(manage_file, None, '__main__', True)
  File "C:\Python27\lib\runpy.py", line 176, in run_module
fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
  File "D:\src\fddd_backend\manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
 
line 338, in execute_from_command_line
utility.execute()
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\__init__.py",
 
line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
 
line 393, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
 
line 443, in execute
self.check()
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\management\base.py",
 
line 481, in check
include_deployment_checks=include_deployment_checks,
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\registry.py",
 
line 72, in run_checks
new_errors = check(app_configs=app_configs)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\core\checks\model_checks.py",
 
line 28, in check_all_models
errors.extend(model.check(**kwargs))
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
 
line 1205, in check
errors.extend(cls._check_fields(**kwargs))
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\base.py",
 
line 1282, in _check_fields
errors.extend(field.check(**kwargs))
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py",
 
line 207, in check
errors.extend(self._check_backend_specific_checks(**kwargs))
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields\__init__.py",
 
line 306, in _check_backend_specific_checks
return connection.validation.check_field(self, **kwargs)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\backends\mysql\validation.py",
 
line 18, in check_field
field_type = field.db_type(connection)
  File 
"C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\contrib\gis\db\models\fields.py",
 
line 247, in db_type
return connection.ops.geo_db_type(self)
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'


Is there something wrong with my settings?

-- 
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/3fa379ce-170f-48a3-911c-c8db168c6d53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


http://stackoverflow.com/questions/32549006/how-to-automatically-save-the-headline-for-every-new-article-provided-my-3rd-par

2015-09-14 Thread n00b
http://stackoverflow.com/questions/32549006/how-to-automatically-save-the-headline-for-every-new-article-provided-my-3rd-par

-- 
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/4eccc6bc-4aa9-4fc6-95d9-91f223ad2a44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.