google-code-export / sct-project

Automatically exported from code.google.com/p/sct-project
1 stars 1 forks source link

Pb install, Table 'community_group' on Postgres : group 'example' is duplicated #213

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. install sct with postgresql
2. run 'manage.py syncdb'
3. follow the process (tables creation, then superuser creation, validation of 
superuser password) 
4. and now error

What is the expected output? What do you see instead?
File 
"/usr/local/lib/python2.6/dist-packages/Sphene_Community_Tools-0.6-py2.6.egg/sph
ene/sphboard/management.py", line 9, in init_data
    group = Group.objects.get( name = 'example' )

File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 
117, in get
    return self.get_query_set().get(*args, **kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 
324, in get
    % (self.model._meta.object_name, num, kwargs))

sphene.community.models.MultipleObjectsReturned: get() returned more than one 
Group -- it returned 2! Lookup parameters were {'name': 'example'}

Run 'manage.py runserver' leads to a 404 error 'No Group matches the given 
query'

What version of the product are you using? On what operating system?
- Ubuntu 10.04
- Postgres 8.1
- Django 1.0.4

Please provide any additional information below.
On MySql it works perfectly. When i compare the content of the table 
'community_group' between mysql and postgres, i can see that, within the 
postgres instance, the table has 2 groups called 'example'. Data is written 
twice. 

I modified the file :
File 
"/usr/local/lib/python2.6/dist-packages/Sphene_Community_Tools-0.6-py2.6.egg/sph
ene/sphboard/management.py", line 9, in init_data
    group = Group.objects.get( name = 'example' )
by group = Group.objects.filter( name = 'example' )[0]

I don t have any error message anymore at syncdb and the table creation process 
is going on until the end. But i still get the same 404 error and message 'No 
Group matches the given query'

I really have no idea what's going on.

Original issue reported on code.google.com by awa...@gmail.com on 19 Aug 2010 at 10:06

GoogleCodeExporter commented 9 years ago
Ps : i m using SCT 0.6

Original comment by awa...@gmail.com on 19 Aug 2010 at 10:08

GoogleCodeExporter commented 9 years ago
well .. i've just tried to reinstall a mysql instance from scratch and i have 
the same pb.. so i m gonna clean it up and reinstall sct completely

Original comment by awa...@gmail.com on 20 Aug 2010 at 1:05

GoogleCodeExporter commented 9 years ago
i don't get it. Because the pb did not occur at the beginning, i now 
uninstalled every component i've installed in the meantime : every package 
needed for geodjango, plus postgresql. Nothing changed.  

Original comment by awa...@gmail.com on 20 Aug 2010 at 5:44

GoogleCodeExporter commented 9 years ago
weird, the 'example' group is created during the initial 'syncdb' .. it 
shouldn't put it twice into the table.. but i have seen that problem before, 
although i'm not sure how it was fixed.. the easiest way to solve this is to 
delete one of the 'example' groups in the community_group table by hand..

it would also be nice if you could try out SCT from the subversion trunk, if 
you encounter the same problem there

thanks!

Original comment by herbert....@gmail.com on 20 Aug 2010 at 6:32

GoogleCodeExporter commented 9 years ago
Hi and thanks a lot for the reply! it seems it helped in a way
Well. I had already tried to delete one of the record by hand before, did not 
helped.
But i modifyed the code like this to avoid writing 2 times the line and it 
works now ! Now i can start the server properly

in the file sphene/community/management/__init__.py line 7 

def init_data(app, created_models, verbosity, **kwargs):
  6     from sphene.community.models import Group, Navigation, CommunityUserProfileField
  7     if (Group in created_models) and not (Group.objects.filter( name = 'example' ) ):

Original comment by awa...@gmail.com on 20 Aug 2010 at 7:18