Re: Question about users system

2016-04-15 Thread Luis Zárate
I thing Sites framework do something similiar to you problem, so you could
study how is implemented.


https://docs.djangoproject.com/en/1.9/ref/contrib/sites/




El viernes, 15 de abril de 2016, Eduardo Leones <
edua...@ypytecnologia.com.br> escribió:
> Javier, thanks for the answer.
> Very interesting "multi-Tenat" solution, including found this really cool
below:
> https://github.com/bernardopires/django-tenant-schemas
> What worried me was his observation that is not a simple implementation
to be done in Django. What is the biggest difficulty in this method?
> I think your suggestion to create a separate table for fantastic company
and I think the best solution at the moment.
> tks
>
> Em sexta-feira, 15 de abril de 2016 10:27:43 UTC-3, Javier Guerra
escreveu:
>>
>> On 15 April 2016 at 12:17, Eduardo Leones 
wrote:
>> > I am developing a system in which my clients are companies. Every
company
>> > needs to have its isolated from other business data.
>>
>> google for "multi-tenant" web applications.  warning: there are quite
>> strong opinions about how it should be done.
>>
>> in particular, there's lots of advice of setting a separate database
>> for each tenant.  It does have some advantages, but in practice it's
>> not easy to do in Django.
>>
>>
>> > My reasoning is to register each client (company) as a group within the
>> > Django auth system. Users of them would be users connected to this
group.
>>
>> Yes, this can work.  Personally, instead of reusing the Group tabke, I
>> tend to create a specific 'Company' table, and add a 'company' foreign
>> key to users.  The reasoning is that you _will_ have other groups that
>> are not companies (maybe internal divisions, or for access-level
>> privileges, whatever), and then you have the problem of separating two
>> kinds of groups.
>>
>>
>> > This line of thinking is correct? There is a decorators to limit
access to
>> > the Group as a whole? In part of the Model link the data to a group is
a
>> > good practice?
>>
>> Make sure that every record can be traced to a specific Company, some
>> of them because they're linked to a User, or maybe by a direct
>> 'company' link.  Then be _absolutely_ sure that every database query
>> includes a company condition.
>>
>> something like this:
>>
>> @login_required
>> def getsomething(request, id):
>> thing = get_object_or_404(Thing,
>> department__company=request.user.company, id=id)
>>  build response ...
>>
>>
>> It's tempting to put the "current" company somewhere and patch all
>> requests to include that, but it gets very complex quickly, and also
>> you get the problem of managing what in effect is a global variable.
>> not worth it.
>>
>>
>> --
>> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/89dad6b7-4967-48af-8554-e1a53f2d584f%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

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


Problem with django.contrib.session datetimes after Django upgrade

2016-04-15 Thread Jens Wetzl
Hi,

I upgraded from Django 1.7.x to 1.9.5 and now get sporadic errors like this 
that come from the django.contrib.sessions module (the full stack trace is 
below):

Exception Type: ValueError at /subscriptions/
Exception Value: make_aware expects a naive datetime, got 2016-04-21 
23:26:19.247888+00:00

Sporadic in the sense that when I visit the site and get the error, I can 
refresh and it is gone. If I wait for a while (e.g. the next day) and go to 
the site again, the error is back once and then goes away again if I 
refresh. I haven't figured out the timespan I need to wait before the error 
reappears yet, but assume it has to do with caching.

I think it cannot be a problem with my own code, as the stack trace only 
contains stock Django functionality and my own code doesn't directly access 
or meddle with the Session models. If I understand correctly, Session 
objects are selected from the database with a filter on their expire_date, 
and at some point, this expire_date datetime object should be converted 
from native to aware, which fails because it is aware already.

My first assumption was that there was a change from Django 1.7 to 1.9 and 
that the objects already saved in the database with Django 1.7 code are no 
longer compatible with Django 1.9. So I deleted all Session objects from 
the database and then start a new session by logging in again. However, the 
resulting Session object also has an expire_date which is aware already, so 
it would run into the same problem again.

I use sqlite as the database backend, if that's relevant.

Any idea what the problem might be?

Thanks in advance!
Jens

--

ValueError at /subscriptions/
make_aware expects a naive datetime, got 2016-04-21 23:26:19.247888+00:00

Request Method: GET
Request URL: https://.../subscriptions/ 
Django Version: 1.9.5
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path: ['/root/.virtualenvs/django19/lib/python2.7/site-packages', 
'/var/www/MYAPP', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', 
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', 
'/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', 
'/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7']
Server time: Fri, 15 Apr 2016 21:02:49 +0200
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'MYAPP',
'django_extensions',
'debug_toolbar')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback:  

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/core/handlers/base.py"
 
in get_response
 149. response = 
self.process_exception_by_middleware(e, request)

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/core/handlers/base.py"
 
in get_response
 147. response = wrapped_callback(request, 
*callback_args, **callback_kwargs)

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/decorators.py"
 
in _wrapped_view
 22. if test_func(request.user):

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/decorators.py"
 
in 
 46. lambda u: u.is_authenticated(),

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/utils/functional.py"
 
in inner
 204. self._setup()

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/utils/functional.py"
 
in _setup
 351. self._wrapped = self._setupfunc()

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/middleware.py"
 
in 
 22. request.user = SimpleLazyObject(lambda: get_user(request))

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/middleware.py"
 
in get_user
 10. request._cached_user = auth.get_user(request)

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/__init__.py"
 
in get_user
 167. user_id = _get_user_session_key(request)

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/__init__.py"
 
in _get_user_session_key
 59. return 
get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py"
 
in __getitem__
 48. return self._session[key]

File 
"/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py"
 
in _get_session
 198. 

How to customizing CSS in djangocms-table

2016-04-15 Thread Régis Silva
I use djangocms-table . And this 
plugin return


  Tabela exemplo
  

  2
  3
  5
  8
  


  a
  b
  c
  d
  e


  f
  g
  h
  i
  j

  



But i need with Bootstrap style. I need


  

  
  2
  3
  5
  8


  a
  b
  c
  d
  e


  f
  g
  h
  i
  j

  


I'm not talking to insert the CSS properly, but extend the plugin so that 
it returns this bootstrap style.

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


Re: Design hints for a sanity checker

2016-04-15 Thread Derek
You probably want to use Celery for asynchronous processing e.g. 
see http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html 
(plus a TON on material on the web...).

PS We welcome all refugees from the "static-only-HTML" 1990's here ;)

On Friday, 15 April 2016 14:23:51 UTC+2, Erik Cederstrand wrote:
>
> Hi list, 
>
> I need to implement a sanity checker for my (power) users. Basically they 
> should press a button on my website, and my backend runs a checklist of 
> 20-30 items to check that their setup is OK and report progress while the 
> checks are running. Some checks are fast, and others could take a long time 
> - testing connections to external systems and things like that. 
>
> I'm still a static HTML kinda guy, so I'm looking for hints on how to 
> design this with Django. I'm looking for something simple, but also best 
> practice so I learn the right habits from the start :-) 
>
> Thanks, 
> Erik

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


Re: Question about users system

2016-04-15 Thread Eduardo Leones
Javier, thanks for the answer.

Very interesting "multi-Tenat" solution, including found this really cool 
below:

https://github.com/bernardopires/django-tenant-schemas

What worried me was his observation that is not a simple implementation to 
be done in Django. What is the biggest difficulty in this method?

I think your suggestion to create a separate table for fantastic company 
and I think the best solution at the moment.

tks


Em sexta-feira, 15 de abril de 2016 10:27:43 UTC-3, Javier Guerra escreveu:
>
> On 15 April 2016 at 12:17, Eduardo Leones  > wrote: 
> > I am developing a system in which my clients are companies. Every 
> company 
> > needs to have its isolated from other business data. 
>
> google for "multi-tenant" web applications.  warning: there are quite 
> strong opinions about how it should be done. 
>
> in particular, there's lots of advice of setting a separate database 
> for each tenant.  It does have some advantages, but in practice it's 
> not easy to do in Django. 
>
>
> > My reasoning is to register each client (company) as a group within the 
> > Django auth system. Users of them would be users connected to this 
> group. 
>
> Yes, this can work.  Personally, instead of reusing the Group tabke, I 
> tend to create a specific 'Company' table, and add a 'company' foreign 
> key to users.  The reasoning is that you _will_ have other groups that 
> are not companies (maybe internal divisions, or for access-level 
> privileges, whatever), and then you have the problem of separating two 
> kinds of groups. 
>
>
> > This line of thinking is correct? There is a decorators to limit access 
> to 
> > the Group as a whole? In part of the Model link the data to a group is a 
> > good practice? 
>
> Make sure that every record can be traced to a specific Company, some 
> of them because they're linked to a User, or maybe by a direct 
> 'company' link.  Then be _absolutely_ sure that every database query 
> includes a company condition. 
>
> something like this: 
>
> @login_required 
> def getsomething(request, id): 
> thing = get_object_or_404(Thing, 
> department__company=request.user.company, id=id) 
>  build response ... 
>
>
> It's tempting to put the "current" company somewhere and patch all 
> requests to include that, but it gets very complex quickly, and also 
> you get the problem of managing what in effect is a global variable. 
> not worth it. 
>
>
> -- 
> Javier 
>

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


Re: Running Django-Test fails with TransactionManagementError

2016-04-15 Thread John Griebel
Glad to hear it, sorry I wasn't more help.

On Fri, Apr 15, 2016 at 10:49 AM,  wrote:

> Hey John,
> cool it runs now.
> I had multiple problems:
>
> 1.) I granted ALL rights to my user on the test DB.
> ==> This solved the issue with the TransactionManagementError.
>
> 2.) I had to do some changes in my configuration and play around.
> Afterwards the tests were running. But not all green :-|
>
> Thanks for your help
> Have a nice weekend
> schaf
>
> Am Freitag, 15. April 2016 16:08:21 UTC+2 schrieb scha...@gmail.com:
>>
>> No I have not added a target. The reason is that there is a class
>> deriving from NoseTestSuiteRunner.
>> This class defines the run_tests function which modifies the test_labels
>> passed to the base 'constructor'.
>> If I add a Target for a single test (testclass.testMethod) then just this
>> test method would be called, but if I start the debugger, I get the same
>> error, before I run into the setUp or the specific test function. So I do
>> not get to that point.
>> Also the 'empty test suite' confuses me. because I have tests, just not
>> in a subdirectory of each app, but in a separate tests directory.
>>
>>
>>
>>
>>
>>
>> Am Freitag, 15. April 2016 15:52:13 UTC+2 schrieb John Griebel:
>>>
>>> The next step (for me at least) would be to start removing/commenting
>>> out things from the tests file until you stop getting the error. Hopefully
>>> that will tell you what statement(s) may be causing the problem. Although I
>>> fear you may be correct in thinking this is a configuration issue.
>>>
>>> Have you tried adding a Target? Does the app itself run without this
>>> error?
>>>
>>> On Fri, Apr 15, 2016 at 9:29 AM,  wrote:
>>>
 Hi John,
 I did now comment out those two files, but still get the same error.
 Maybe I have a wrong configuration or so. I'm quite new in Django /
 Python.

 Regards
 schaf

 Am Freitag, 15. April 2016 15:11:40 UTC+2 schrieb John Griebel:
>
> That's what I would try.
>
> On Fri, Apr 15, 2016 at 9:02 AM,  wrote:
>
>> Hi John,
>> thanks, but I did already check for @transaction.commit_manually in
>> the code, but PyCHarm serahc just finds this in the
>> virtualenv/python2.7/site-packages/django_extensions/management/commands.
>> So in my code there is nothing, would you recommend to comment those out,
>> even if it is not from my code just to see whats going on?
>>
>> Thanks
>> schaf
>>
>> Am Freitag, 15. April 2016 14:18:21 UTC+2 schrieb John Griebel:
>>>
>>> If you have methods using the @transaction.commit_manually
>>> decorator, comment those out temporarily. You should get a more helpful
>>> error message after doing so.
>>>
>>> On Fri, Apr 15, 2016 at 4:44 AM,  wrote:
>>>
 Hi All,
 I took over some projects written with Python 2.7 / Django 1.5.1.
 For unit tests the django-nose 1.2 (nose 1.3.3) is used and the
 project structure has its own tests directory which contains the
 testrunner.py.
 As a development environment I use PyCharm.
 As I wanted to run the unit tests I created a new run/debug
 configuration.
 I did not add any Target. Just the Environment variable for
 DJANGO_SETTINGS_MODULE and a working directory.

 But when I run/debug the tests, I always get a
 'TransactionManagementError: Transaction managed block ended with 
 pending
 COMMIT/ROLLBACK
 It also say that no tests were found but the test DB was created.
 Do you have any hints?

 Connected to pydev debugger (build 141.1899)
 /home/schaf/workspace/Solution/env/bin/python /home/schaf/
 Schreibtisch/pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client
 127.0.0.1 --port 60525 --file /home/schaf/Schreibtisch/pycharm-4.5.
 3/helpers/pycharm/django_test_manage.py test /home/schaf/workspace/
 Solution
 Testing started at 10:24 ...
 pydev debugger: process 5727 is connecting

 nosetests tests.testUrlAnalyzer --with-coverage --cover-html --
 cover-html-dir=./tests/coverage --cover-erase --cover-package=
 UrlAnalyzer --verbosity=1
 Creating test database for alias 'default'...
 TransactionManagementError: Transaction managed block ended with
 pending COMMIT/ROLLBACK

 Process finished with exit code 1
 Empty test suite.


 Thanks
 schaf

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

Re: Running Django-Test fails with TransactionManagementError

2016-04-15 Thread schaf . mh
Hey John,
cool it runs now. 
I had multiple problems:

1.) I granted ALL rights to my user on the test DB.
==> This solved the issue with the TransactionManagementError.

2.) I had to do some changes in my configuration and play around. 
Afterwards the tests were running. But not all green :-|

Thanks for your help
Have a nice weekend
schaf

Am Freitag, 15. April 2016 16:08:21 UTC+2 schrieb scha...@gmail.com:
>
> No I have not added a target. The reason is that there is a class deriving 
> from NoseTestSuiteRunner.
> This class defines the run_tests function which modifies the test_labels 
> passed to the base 'constructor'.
> If I add a Target for a single test (testclass.testMethod) then just this 
> test method would be called, but if I start the debugger, I get the same 
> error, before I run into the setUp or the specific test function. So I do 
> not get to that point.
> Also the 'empty test suite' confuses me. because I have tests, just not in 
> a subdirectory of each app, but in a separate tests directory.
>
>
>
>
>
>
> Am Freitag, 15. April 2016 15:52:13 UTC+2 schrieb John Griebel:
>>
>> The next step (for me at least) would be to start removing/commenting out 
>> things from the tests file until you stop getting the error. Hopefully that 
>> will tell you what statement(s) may be causing the problem. Although I fear 
>> you may be correct in thinking this is a configuration issue. 
>>
>> Have you tried adding a Target? Does the app itself run without this 
>> error?
>>
>> On Fri, Apr 15, 2016 at 9:29 AM,  wrote:
>>
>>> Hi John,
>>> I did now comment out those two files, but still get the same error.
>>> Maybe I have a wrong configuration or so. I'm quite new in Django / 
>>> Python.
>>>
>>> Regards
>>> schaf
>>>
>>> Am Freitag, 15. April 2016 15:11:40 UTC+2 schrieb John Griebel:

 That's what I would try. 

 On Fri, Apr 15, 2016 at 9:02 AM,  wrote:

> Hi John,
> thanks, but I did already check for @transaction.commit_manually in 
> the code, but PyCHarm serahc just finds this in the 
> virtualenv/python2.7/site-packages/django_extensions/management/commands. 
> So in my code there is nothing, would you recommend to comment those out, 
> even if it is not from my code just to see whats going on?
>
> Thanks
> schaf
>
> Am Freitag, 15. April 2016 14:18:21 UTC+2 schrieb John Griebel:
>>
>> If you have methods using the @transaction.commit_manually decorator, 
>> comment those out temporarily. You should get a more helpful error 
>> message 
>> after doing so. 
>>
>> On Fri, Apr 15, 2016 at 4:44 AM,  wrote:
>>
>>> Hi All,
>>> I took over some projects written with Python 2.7 / Django 1.5.1.
>>> For unit tests the django-nose 1.2 (nose 1.3.3) is used and the 
>>> project structure has its own tests directory which contains the 
>>> testrunner.py.
>>> As a development environment I use PyCharm.
>>> As I wanted to run the unit tests I created a new run/debug 
>>> configuration.
>>> I did not add any Target. Just the Environment variable for 
>>> DJANGO_SETTINGS_MODULE and a working directory.
>>>
>>> But when I run/debug the tests, I always get a 
>>> 'TransactionManagementError: Transaction managed block ended with 
>>> pending 
>>> COMMIT/ROLLBACK
>>> It also say that no tests were found but the test DB was created.
>>> Do you have any hints?
>>>
>>> Connected to pydev debugger (build 141.1899)
>>> /home/schaf/workspace/Solution/env/bin/python /home/schaf/
>>> Schreibtisch/pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 
>>> 127.0.0.1 --port 60525 --file /home/schaf/Schreibtisch/pycharm-4.5.3
>>> /helpers/pycharm/django_test_manage.py test /home/schaf/workspace/
>>> Solution
>>> Testing started at 10:24 ...
>>> pydev debugger: process 5727 is connecting
>>>
>>> nosetests tests.testUrlAnalyzer --with-coverage --cover-html --cover
>>> -html-dir=./tests/coverage --cover-erase --cover-package=UrlAnalyzer 
>>> --verbosity=1
>>> Creating test database for alias 'default'...
>>> TransactionManagementError: Transaction managed block ended with 
>>> pending COMMIT/ROLLBACK
>>>
>>> Process finished with exit code 1
>>> Empty test suite.
>>>
>>>
>>> Thanks
>>> schaf
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, 
>>> send an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> 

Re:

2016-04-15 Thread Mads Viborg Jørgensen
I'm kind of stuck on the same thing here. And I'm interested in a solution 
as I beleive it is causing me some troubles.
My relevant settings.py are:
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
# 'whitenoise.runserver_nostatic',
'django.contrib.staticfiles',
# Resently added
'haystack',
'whoosh',
# our app(s)
'hello',
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
#'whitenoise.middleware.WhiteNoiseMiddleware',
)


Den torsdag den 4. februar 2016 kl. 10.43.13 UTC+1 skrev James Schneider:
>
> >> Deploying with verbosity=0 solved my problem.
> >>
>
> Workaround is probably a better term than solved. ;-)
>
> >> Something is happening in that  self.log(  call at line 112 that make 
> it crash on Heroku. Unsure what it is and unsure the issue is on Django 
> side.
> >>
>
> Providing the code (and reasonable context from surrounding statements) 
> around line 112 would be a big help if you want to troubleshoot further. 
> Logging settings would be helpful as well.
>
> >> At least this resolves my problem and there is some reference if 
> someone else encounter this issue on Heroku too...
> >>
>
> Do you encounter this issue on your local dev machine, or are you 
> publishing/developing directly on Heroku?
>
> Is it possible that you are hitting some sort of upper limit in your 
> Heroku instance such as memory usage, logging rate, or file creation rate? 
> Perhaps you are bursting past the standard resource allocations and the 
> system is denying requested resources to your Django process (since you 
> mentioned thousands of lines in your output)?
>
> Does Heroku have any sort of OS level logging for the container where your 
> instance is running? That may provide some clues as to why your script 
> seems to be failing at random points in the file creation process.
>
> -James
>

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


Re: Running Django-Test fails with TransactionManagementError

2016-04-15 Thread schaf . mh
No I have not added a target. The reason is that there is a class deriving 
from NoseTestSuiteRunner.
This class defines the run_tests function which modifies the test_labels 
passed to the base 'constructor'.
If I add a Target for a single test (testclass.testMethod) then just this 
test method would be called, but if I start the debugger, I get the same 
error, before I run into the setUp or the specific test function. So I do 
not get to that point.
Also the 'empty test suite' confuses me. because I have tests, just not in 
a subdirectory of each app, but in a separate tests directory.






Am Freitag, 15. April 2016 15:52:13 UTC+2 schrieb John Griebel:
>
> The next step (for me at least) would be to start removing/commenting out 
> things from the tests file until you stop getting the error. Hopefully that 
> will tell you what statement(s) may be causing the problem. Although I fear 
> you may be correct in thinking this is a configuration issue. 
>
> Have you tried adding a Target? Does the app itself run without this error?
>
> On Fri, Apr 15, 2016 at 9:29 AM,  wrote:
>
>> Hi John,
>> I did now comment out those two files, but still get the same error.
>> Maybe I have a wrong configuration or so. I'm quite new in Django / 
>> Python.
>>
>> Regards
>> schaf
>>
>> Am Freitag, 15. April 2016 15:11:40 UTC+2 schrieb John Griebel:
>>>
>>> That's what I would try. 
>>>
>>> On Fri, Apr 15, 2016 at 9:02 AM,  wrote:
>>>
 Hi John,
 thanks, but I did already check for @transaction.commit_manually in the 
 code, but PyCHarm serahc just finds this in the 
 virtualenv/python2.7/site-packages/django_extensions/management/commands. 
 So in my code there is nothing, would you recommend to comment those out, 
 even if it is not from my code just to see whats going on?

 Thanks
 schaf

 Am Freitag, 15. April 2016 14:18:21 UTC+2 schrieb John Griebel:
>
> If you have methods using the @transaction.commit_manually decorator, 
> comment those out temporarily. You should get a more helpful error 
> message 
> after doing so. 
>
> On Fri, Apr 15, 2016 at 4:44 AM,  wrote:
>
>> Hi All,
>> I took over some projects written with Python 2.7 / Django 1.5.1.
>> For unit tests the django-nose 1.2 (nose 1.3.3) is used and the 
>> project structure has its own tests directory which contains the 
>> testrunner.py.
>> As a development environment I use PyCharm.
>> As I wanted to run the unit tests I created a new run/debug 
>> configuration.
>> I did not add any Target. Just the Environment variable for 
>> DJANGO_SETTINGS_MODULE and a working directory.
>>
>> But when I run/debug the tests, I always get a 
>> 'TransactionManagementError: Transaction managed block ended with 
>> pending 
>> COMMIT/ROLLBACK
>> It also say that no tests were found but the test DB was created.
>> Do you have any hints?
>>
>> Connected to pydev debugger (build 141.1899)
>> /home/schaf/workspace/Solution/env/bin/python /home/schaf/
>> Schreibtisch/pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 
>> 127.0.0.1 --port 60525 --file /home/schaf/Schreibtisch/pycharm-4.5.3/
>> helpers/pycharm/django_test_manage.py test /home/schaf/workspace/
>> Solution
>> Testing started at 10:24 ...
>> pydev debugger: process 5727 is connecting
>>
>> nosetests tests.testUrlAnalyzer --with-coverage --cover-html --cover-
>> html-dir=./tests/coverage --cover-erase --cover-package=UrlAnalyzer 
>> --verbosity=1
>> Creating test database for alias 'default'...
>> TransactionManagementError: Transaction managed block ended with 
>> pending COMMIT/ROLLBACK
>>
>> Process finished with exit code 1
>> Empty test suite.
>>
>>
>> Thanks
>> schaf
>>
>> -- 
>> You received this message because you are subscribed to the Google 
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, 
>> send an email to django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/ca1ca36f-0e7a-4da4-8f69-cc5c4b29a7c7%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...@googlegroups.com.
 To post to 

Re: Running Django-Test fails with TransactionManagementError

2016-04-15 Thread John Griebel
The next step (for me at least) would be to start removing/commenting out
things from the tests file until you stop getting the error. Hopefully that
will tell you what statement(s) may be causing the problem. Although I fear
you may be correct in thinking this is a configuration issue.

Have you tried adding a Target? Does the app itself run without this error?

On Fri, Apr 15, 2016 at 9:29 AM,  wrote:

> Hi John,
> I did now comment out those two files, but still get the same error.
> Maybe I have a wrong configuration or so. I'm quite new in Django / Python.
>
> Regards
> schaf
>
> Am Freitag, 15. April 2016 15:11:40 UTC+2 schrieb John Griebel:
>>
>> That's what I would try.
>>
>> On Fri, Apr 15, 2016 at 9:02 AM,  wrote:
>>
>>> Hi John,
>>> thanks, but I did already check for @transaction.commit_manually in the
>>> code, but PyCHarm serahc just finds this in the
>>> virtualenv/python2.7/site-packages/django_extensions/management/commands.
>>> So in my code there is nothing, would you recommend to comment those out,
>>> even if it is not from my code just to see whats going on?
>>>
>>> Thanks
>>> schaf
>>>
>>> Am Freitag, 15. April 2016 14:18:21 UTC+2 schrieb John Griebel:

 If you have methods using the @transaction.commit_manually decorator,
 comment those out temporarily. You should get a more helpful error message
 after doing so.

 On Fri, Apr 15, 2016 at 4:44 AM,  wrote:

> Hi All,
> I took over some projects written with Python 2.7 / Django 1.5.1.
> For unit tests the django-nose 1.2 (nose 1.3.3) is used and the
> project structure has its own tests directory which contains the
> testrunner.py.
> As a development environment I use PyCharm.
> As I wanted to run the unit tests I created a new run/debug
> configuration.
> I did not add any Target. Just the Environment variable for
> DJANGO_SETTINGS_MODULE and a working directory.
>
> But when I run/debug the tests, I always get a
> 'TransactionManagementError: Transaction managed block ended with pending
> COMMIT/ROLLBACK
> It also say that no tests were found but the test DB was created.
> Do you have any hints?
>
> Connected to pydev debugger (build 141.1899)
> /home/schaf/workspace/Solution/env/bin/python /home/schaf/Schreibtisch
> /pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1
> --port 60525 --file /home/schaf/Schreibtisch/pycharm-4.5.3/helpers/
> pycharm/django_test_manage.py test /home/schaf/workspace/Solution
> Testing started at 10:24 ...
> pydev debugger: process 5727 is connecting
>
> nosetests tests.testUrlAnalyzer --with-coverage --cover-html --cover-
> html-dir=./tests/coverage --cover-erase --cover-package=UrlAnalyzer --
> verbosity=1
> Creating test database for alias 'default'...
> TransactionManagementError: Transaction managed block ended with
> pending COMMIT/ROLLBACK
>
> Process finished with exit code 1
> Empty test suite.
>
>
> Thanks
> schaf
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ca1ca36f-0e7a-4da4-8f69-cc5c4b29a7c7%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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/47dd5892-9461-4ea1-b0df-ddb9cd5b88be%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 

Re: Running Django-Test fails with TransactionManagementError

2016-04-15 Thread schaf . mh
Hi John,
I did now comment out those two files, but still get the same error.
Maybe I have a wrong configuration or so. I'm quite new in Django / Python.

Regards
schaf

Am Freitag, 15. April 2016 15:11:40 UTC+2 schrieb John Griebel:
>
> That's what I would try. 
>
> On Fri, Apr 15, 2016 at 9:02 AM,  wrote:
>
>> Hi John,
>> thanks, but I did already check for @transaction.commit_manually in the 
>> code, but PyCHarm serahc just finds this in the 
>> virtualenv/python2.7/site-packages/django_extensions/management/commands. 
>> So in my code there is nothing, would you recommend to comment those out, 
>> even if it is not from my code just to see whats going on?
>>
>> Thanks
>> schaf
>>
>> Am Freitag, 15. April 2016 14:18:21 UTC+2 schrieb John Griebel:
>>>
>>> If you have methods using the @transaction.commit_manually decorator, 
>>> comment those out temporarily. You should get a more helpful error message 
>>> after doing so. 
>>>
>>> On Fri, Apr 15, 2016 at 4:44 AM,  wrote:
>>>
 Hi All,
 I took over some projects written with Python 2.7 / Django 1.5.1.
 For unit tests the django-nose 1.2 (nose 1.3.3) is used and the project 
 structure has its own tests directory which contains the testrunner.py.
 As a development environment I use PyCharm.
 As I wanted to run the unit tests I created a new run/debug 
 configuration.
 I did not add any Target. Just the Environment variable for 
 DJANGO_SETTINGS_MODULE and a working directory.

 But when I run/debug the tests, I always get a 
 'TransactionManagementError: Transaction managed block ended with pending 
 COMMIT/ROLLBACK
 It also say that no tests were found but the test DB was created.
 Do you have any hints?

 Connected to pydev debugger (build 141.1899)
 /home/schaf/workspace/Solution/env/bin/python /home/schaf/Schreibtisch/
 pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 
 --port 
 60525 --file /home/schaf/Schreibtisch/pycharm-4.5.3/helpers/pycharm/
 django_test_manage.py test /home/schaf/workspace/Solution
 Testing started at 10:24 ...
 pydev debugger: process 5727 is connecting

 nosetests tests.testUrlAnalyzer --with-coverage --cover-html --cover-
 html-dir=./tests/coverage --cover-erase --cover-package=UrlAnalyzer --
 verbosity=1
 Creating test database for alias 'default'...
 TransactionManagementError: Transaction managed block ended with 
 pending COMMIT/ROLLBACK

 Process finished with exit code 1
 Empty test suite.


 Thanks
 schaf

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/ca1ca36f-0e7a-4da4-8f69-cc5c4b29a7c7%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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/47dd5892-9461-4ea1-b0df-ddb9cd5b88be%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: Question about users system

2016-04-15 Thread Javier Guerra Giraldez
On 15 April 2016 at 12:17, Eduardo Leones  wrote:
> I am developing a system in which my clients are companies. Every company
> needs to have its isolated from other business data.

google for "multi-tenant" web applications.  warning: there are quite
strong opinions about how it should be done.

in particular, there's lots of advice of setting a separate database
for each tenant.  It does have some advantages, but in practice it's
not easy to do in Django.


> My reasoning is to register each client (company) as a group within the
> Django auth system. Users of them would be users connected to this group.

Yes, this can work.  Personally, instead of reusing the Group tabke, I
tend to create a specific 'Company' table, and add a 'company' foreign
key to users.  The reasoning is that you _will_ have other groups that
are not companies (maybe internal divisions, or for access-level
privileges, whatever), and then you have the problem of separating two
kinds of groups.


> This line of thinking is correct? There is a decorators to limit access to
> the Group as a whole? In part of the Model link the data to a group is a
> good practice?

Make sure that every record can be traced to a specific Company, some
of them because they're linked to a User, or maybe by a direct
'company' link.  Then be _absolutely_ sure that every database query
includes a company condition.

something like this:

@login_required
def getsomething(request, id):
thing = get_object_or_404(Thing,
department__company=request.user.company, id=id)
 build response ...


It's tempting to put the "current" company somewhere and patch all
requests to include that, but it gets very complex quickly, and also
you get the problem of managing what in effect is a global variable.
not worth it.


-- 
Javier

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


Re: Running Django-Test fails with TransactionManagementError

2016-04-15 Thread John Griebel
That's what I would try.

On Fri, Apr 15, 2016 at 9:02 AM,  wrote:

> Hi John,
> thanks, but I did already check for @transaction.commit_manually in the
> code, but PyCHarm serahc just finds this in the
> virtualenv/python2.7/site-packages/django_extensions/management/commands.
> So in my code there is nothing, would you recommend to comment those out,
> even if it is not from my code just to see whats going on?
>
> Thanks
> schaf
>
> Am Freitag, 15. April 2016 14:18:21 UTC+2 schrieb John Griebel:
>>
>> If you have methods using the @transaction.commit_manually decorator,
>> comment those out temporarily. You should get a more helpful error message
>> after doing so.
>>
>> On Fri, Apr 15, 2016 at 4:44 AM,  wrote:
>>
>>> Hi All,
>>> I took over some projects written with Python 2.7 / Django 1.5.1.
>>> For unit tests the django-nose 1.2 (nose 1.3.3) is used and the project
>>> structure has its own tests directory which contains the testrunner.py.
>>> As a development environment I use PyCharm.
>>> As I wanted to run the unit tests I created a new run/debug
>>> configuration.
>>> I did not add any Target. Just the Environment variable for
>>> DJANGO_SETTINGS_MODULE and a working directory.
>>>
>>> But when I run/debug the tests, I always get a
>>> 'TransactionManagementError: Transaction managed block ended with pending
>>> COMMIT/ROLLBACK
>>> It also say that no tests were found but the test DB was created.
>>> Do you have any hints?
>>>
>>> Connected to pydev debugger (build 141.1899)
>>> /home/schaf/workspace/Solution/env/bin/python /home/schaf/Schreibtisch/
>>> pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port
>>> 60525 --file /home/schaf/Schreibtisch/pycharm-4.5.3/helpers/pycharm/
>>> django_test_manage.py test /home/schaf/workspace/Solution
>>> Testing started at 10:24 ...
>>> pydev debugger: process 5727 is connecting
>>>
>>> nosetests tests.testUrlAnalyzer --with-coverage --cover-html --cover-
>>> html-dir=./tests/coverage --cover-erase --cover-package=UrlAnalyzer --
>>> verbosity=1
>>> Creating test database for alias 'default'...
>>> TransactionManagementError: Transaction managed block ended with
>>> pending COMMIT/ROLLBACK
>>>
>>> Process finished with exit code 1
>>> Empty test suite.
>>>
>>>
>>> Thanks
>>> schaf
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/ca1ca36f-0e7a-4da4-8f69-cc5c4b29a7c7%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/47dd5892-9461-4ea1-b0df-ddb9cd5b88be%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Running Django-Test fails with TransactionManagementError

2016-04-15 Thread schaf . mh
Hi John,
thanks, but I did already check for @transaction.commit_manually in the 
code, but PyCHarm serahc just finds this in the 
virtualenv/python2.7/site-packages/django_extensions/management/commands. 
So in my code there is nothing, would you recommend to comment those out, 
even if it is not from my code just to see whats going on?

Thanks
schaf

Am Freitag, 15. April 2016 14:18:21 UTC+2 schrieb John Griebel:
>
> If you have methods using the @transaction.commit_manually decorator, 
> comment those out temporarily. You should get a more helpful error message 
> after doing so. 
>
> On Fri, Apr 15, 2016 at 4:44 AM,  wrote:
>
>> Hi All,
>> I took over some projects written with Python 2.7 / Django 1.5.1.
>> For unit tests the django-nose 1.2 (nose 1.3.3) is used and the project 
>> structure has its own tests directory which contains the testrunner.py.
>> As a development environment I use PyCharm.
>> As I wanted to run the unit tests I created a new run/debug configuration.
>> I did not add any Target. Just the Environment variable for 
>> DJANGO_SETTINGS_MODULE and a working directory.
>>
>> But when I run/debug the tests, I always get a 
>> 'TransactionManagementError: Transaction managed block ended with pending 
>> COMMIT/ROLLBACK
>> It also say that no tests were found but the test DB was created.
>> Do you have any hints?
>>
>> Connected to pydev debugger (build 141.1899)
>> /home/schaf/workspace/Solution/env/bin/python /home/schaf/Schreibtisch/
>> pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 
>> 60525 --file /home/schaf/Schreibtisch/pycharm-4.5.3/helpers/pycharm/
>> django_test_manage.py test /home/schaf/workspace/Solution
>> Testing started at 10:24 ...
>> pydev debugger: process 5727 is connecting
>>
>> nosetests tests.testUrlAnalyzer --with-coverage --cover-html --cover-html
>> -dir=./tests/coverage --cover-erase --cover-package=UrlAnalyzer --
>> verbosity=1
>> Creating test database for alias 'default'...
>> TransactionManagementError: Transaction managed block ended with pending 
>> COMMIT/ROLLBACK
>>
>> Process finished with exit code 1
>> Empty test suite.
>>
>>
>> Thanks
>> schaf
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/ca1ca36f-0e7a-4da4-8f69-cc5c4b29a7c7%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Design hints for a sanity checker

2016-04-15 Thread Erik Cederstrand
Hi list,

I need to implement a sanity checker for my (power) users. Basically they 
should press a button on my website, and my backend runs a checklist of 20-30 
items to check that their setup is OK and report progress while the checks are 
running. Some checks are fast, and others could take a long time - testing 
connections to external systems and things like that.

I'm still a static HTML kinda guy, so I'm looking for hints on how to design 
this with Django. I'm looking for something simple, but also best practice so I 
learn the right habits from the start :-)

Thanks,
Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/B051E034-7D58-472E-9D64-2EC8B1FC4712%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Running Django-Test fails with TransactionManagementError

2016-04-15 Thread John Griebel
If you have methods using the @transaction.commit_manually decorator,
comment those out temporarily. You should get a more helpful error message
after doing so.

On Fri, Apr 15, 2016 at 4:44 AM,  wrote:

> Hi All,
> I took over some projects written with Python 2.7 / Django 1.5.1.
> For unit tests the django-nose 1.2 (nose 1.3.3) is used and the project
> structure has its own tests directory which contains the testrunner.py.
> As a development environment I use PyCharm.
> As I wanted to run the unit tests I created a new run/debug configuration.
> I did not add any Target. Just the Environment variable for
> DJANGO_SETTINGS_MODULE and a working directory.
>
> But when I run/debug the tests, I always get a
> 'TransactionManagementError: Transaction managed block ended with pending
> COMMIT/ROLLBACK
> It also say that no tests were found but the test DB was created.
> Do you have any hints?
>
> Connected to pydev debugger (build 141.1899)
> /home/schaf/workspace/Solution/env/bin/python /home/schaf/Schreibtisch/
> pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port
> 60525 --file /home/schaf/Schreibtisch/pycharm-4.5.3/helpers/pycharm/
> django_test_manage.py test /home/schaf/workspace/Solution
> Testing started at 10:24 ...
> pydev debugger: process 5727 is connecting
>
> nosetests tests.testUrlAnalyzer --with-coverage --cover-html --cover-html-
> dir=./tests/coverage --cover-erase --cover-package=UrlAnalyzer --verbosity
> =1
> Creating test database for alias 'default'...
> TransactionManagementError: Transaction managed block ended with pending
> COMMIT/ROLLBACK
>
> Process finished with exit code 1
> Empty test suite.
>
>
> Thanks
> schaf
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ca1ca36f-0e7a-4da4-8f69-cc5c4b29a7c7%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Question about users system

2016-04-15 Thread Eduardo Leones
Good Morning.

First, excuse my English, I hope to have been understood my question.

I'm new in this Django world. My question is more theoretical because I 
have little coded thing in the project.

I am developing a system in which my clients are companies. Every company 
needs to have its isolated from other business data.

My reasoning is to register each client (company) as a group within the 
Django auth system. Users of them would be users connected to this group.

This line of thinking is correct? There is a decorators to limit access to 
the Group as a whole? In part of the Model link the data to a group is a 
good practice?

Well there are many questions, more than all converge on the best way to 
use the Django users system for this type of need.

thank you,

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


Development Server Loading Time Issue: posix.waitpid

2016-04-15 Thread chris mc
Hi guys,

I'm fairly new to Django. I'm running Django 1.3 (stuck with it 
unfortunately) and on my own machine I'm using the development server: 
python manage.py runserver

When I make a change to a pyhton file the development server restarts but 
it's extremely slow to load again. Is this how it should behave? For 
example, using cProfile I can see that posix.waitpid is taking 149 seconds 
which I would guess is causing the problem? As you can imagine when writing 
new code or debugging this is incredibly frustrating and almost unusable. 

Is there anyway that I can fix this or could someone point me in the 
direction of what might be wrong? As mentioned above posix.waitpid takes a 
long time but I'm not sure what this means or what it does. 

Any help is much appreciated. 

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


Running Django-Test fails with TransactionManagementError

2016-04-15 Thread schaf . mh
Hi All,
I took over some projects written with Python 2.7 / Django 1.5.1.
For unit tests the django-nose 1.2 (nose 1.3.3) is used and the project 
structure has its own tests directory which contains the testrunner.py.
As a development environment I use PyCharm.
As I wanted to run the unit tests I created a new run/debug configuration.
I did not add any Target. Just the Environment variable for 
DJANGO_SETTINGS_MODULE and a working directory.

But when I run/debug the tests, I always get a 'TransactionManagementError: 
Transaction managed block ended with pending COMMIT/ROLLBACK
It also say that no tests were found but the test DB was created.
Do you have any hints?

Connected to pydev debugger (build 141.1899)
/home/schaf/workspace/Solution/env/bin/python /home/schaf/Schreibtisch/
pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 
60525 --file /home/schaf/Schreibtisch/pycharm-4.5.3/helpers/pycharm/
django_test_manage.py test /home/schaf/workspace/Solution
Testing started at 10:24 ...
pydev debugger: process 5727 is connecting

nosetests tests.testUrlAnalyzer --with-coverage --cover-html --cover-html-
dir=./tests/coverage --cover-erase --cover-package=UrlAnalyzer --verbosity=1
Creating test database for alias 'default'...
TransactionManagementError: Transaction managed block ended with pending 
COMMIT/ROLLBACK

Process finished with exit code 1
Empty test suite.


Thanks
schaf

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