Wednesday, May 31, 2017

Re: django.db.utils.OperationalError: server closed the connection unexpectedly

Hello,

DATABASES_DEFAULT = {

        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'litdb',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '80',
}

First, if this means what I think it means, it's a very nasty way to define your database. Instead, do this:

DATABASES = {      'default': {          'ENGINE': ...,          ...,      }  }

Now, for what you are asking, PostgreSQL does not listen on port 80; more likely it's listening on port 5432.

Regards,

A.

Antonis Christofides  http://djangodeployment.com
On 2017-05-31 14:35, Bobby Paul wrote:
Dear All,

I am getting this error message while trying to install psql database.

 File "setup.py", line 18, in <module>
    execute_from_command_line(['manage.py','migrate'])
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__
    self.build_graph()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", line 191, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
    self.ensure_schema()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 162, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 135, in _cursor
    self.ensure_connection()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 119, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/bin/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
==========
DATABASES_DEFAULT = {

        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'litdb',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '80',
}

How to sort this issue?

Kind Regards
Bobby Paul
--
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+unsubscribe@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/b07acc86-a2a9-4fe7-9004-0f7a90fe4100%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

django.db.utils.OperationalError: server closed the connection unexpectedly

Dear All,

I am getting this error message while trying to install psql database.

 File "setup.py", line 18, in <module>
    execute_from_command_line(['manage.py','migrate'])
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__
    self.build_graph()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", line 191, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
    self.ensure_schema()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 162, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 135, in _cursor
    self.ensure_connection()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", line 119, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/bin/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
==========
DATABASES_DEFAULT = {

        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'litdb',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '80',
}

How to sort this issue?

Kind Regards
Bobby Paul

--
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+unsubscribe@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/b07acc86-a2a9-4fe7-9004-0f7a90fe4100%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tuesday, May 30, 2017

Re: Is it possible to swap 1.8 and 1.10/1.11 Admin static files

Haven't actually communicated our decision but I'll just see if they are
willing to fund the development involved in staying on an out-of-date
and soon-to-be-unsupported system we'll hire someone to do that.

I think.

Haven't done any research on best practice in this area. Happy to let
you know what happens ;)

Cheers

Mike

On 31/05/2017 10:56 AM, 'Abraham Varricatt' via Django users wrote:
> How ... did you impose our will on this user? ;) I'd like to hear more
> ... for peaceful research purposes, of course.
>
> -Abraham V.
>
>
> On Monday, May 29, 2017 at 9:19:01 PM UTC-4, Mike Dewhirst wrote:
>
> Cancel this question. We will force the user to comply with our
> reality.
>
> Cheers
>
> Mike
>
> On 16/05/2017 5:42 PM, Mike Dewhirst wrote:
> > I have a user who is keen to revert to the "old" 1.8 look and
> feel for
> > his company now that we have upgraded to 1.10.
> >
> > First question is it even possible?
> >
> > I have tested this using blunt force and at first glance it *seems*
> > possible in both directions. However I have a suspicion there
> might be
> > tie-ins I have not discovered. Also. I haven't yet tried 1.11.
> >
> > If it is feasible ...
> >
> > Second question is how to do it.
> >
> > I have stared long and hard at settings. I have this ...
> >
> > STATICFILES_DIRS = [
> > os.path.join(BASE_DIR, 'static/').replace('\\', '/'),
> > os.path.join(BASE_DIR, 'company/static/').replace('\\', '/'),
> > os.path.join(BASE_DIR, 'substance/static/').replace('\\', '/'),
> > os.path.join(BASE_DIR, 'workplace/static/').replace('\\', '/'),
> > ]
> >
> > and
> >
> > STATICFILES_FINDERS = [
> > 'django.contrib.staticfiles.finders.FileSystemFinder',
> > 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> > ]
> >
> > and I can get the user (company) from the request and I can
> create a
> > company subdir under 'company/static/<company>/' if that's where I
> > should be putting the admin files from 1.8. But then how do I tweak
> > the settings so the Admin uses the preferred company static
> files for
> > just that user?
> >
> > Maybe instead, there is a company specific preference I can
> establish
> > to provide '/static/admin_1.8' for that user?
> >
> > Maybe I need to have company-specific Admin templates which
> override
> > the block which reads the static files based on a company
> preference?
> >
> > Any hints?
> >
> > Thanks
> >
> > Mike
> >
>
> --
> 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+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/a1d84a3a-049b-4ba4-9641-579dab3e5f53%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a1d84a3a-049b-4ba4-9641-579dab3e5f53%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 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+unsubscribe@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/cc057d21-a868-5963-951d-5e44e64baf16%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Re: ANN: django-admin-tools 0.8.1 released

By chance do you have any screenshots in your documentation?

-Abraham V.


On Tuesday, May 30, 2017 at 8:39:54 AM UTC-4, izi wrote:
Hello,

We are happy to announce the availability of the version 0.8.1 of
django-admin-tools:
https://pypi.python.org/pypi/django-admin-tools/0.8.1

Django-admin-tools is a collection of extensions/tools for the default
django administration interface, it includes:
* a full featured and customizable dashboard,
* a customizable menu bar,
* tools to make admin theming easier.

This version fixes some issues and adds support for Django 1.11.

Thanks to all the people who contributed to this release.

The project is hosted on Github:
https://github.com/django-admin-tools/django-admin-tools

Django-admin-tools is generously documented, you can browse the
documentation online here:
https://django-admin-tools.readthedocs.org/

Regards,

--
The django-admin-tools team
https://github.com/django-admin-tools/

--
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+unsubscribe@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/d8180d1e-301a-4c51-9040-7a5397f76b3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Is it possible to swap 1.8 and 1.10/1.11 Admin static files

How ... did you impose our will on this user? ;) I'd like to hear more ... for peaceful research purposes, of course.

-Abraham V.


On Monday, May 29, 2017 at 9:19:01 PM UTC-4, Mike Dewhirst wrote:
Cancel this question. We will force the user to comply with our reality.

Cheers

Mike

On 16/05/2017 5:42 PM, Mike Dewhirst wrote:
> I have a user who is keen to revert to the "old" 1.8 look and feel for
> his company now that we have upgraded to 1.10.
>
> First question is it even possible?
>
> I have tested this using blunt force and at first glance it *seems*
> possible in both directions. However I have a suspicion there might be
> tie-ins I have not discovered. Also. I haven't yet tried 1.11.
>
> If it is feasible ...
>
> Second question is how to do it.
>
> I have stared long and hard at settings. I have this ...
>
> STATICFILES_DIRS = [
>     os.path.join(BASE_DIR, 'static/').replace('\\', '/'),
>     os.path.join(BASE_DIR, 'company/static/').replace('\\', '/'),
>     os.path.join(BASE_DIR, 'substance/static/').replace('\\', '/'),
>     os.path.join(BASE_DIR, 'workplace/static/').replace('\\', '/'),
> ]
>
> and
>
> STATICFILES_FINDERS = [
>     'django.contrib.staticfiles.finders.FileSystemFinder',
>     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> ]
>
> and I can get the user (company) from the request and I can create a
> company subdir under 'company/static/<company>/' if that's where I
> should be putting the admin files from 1.8. But then how do I tweak
> the settings so the Admin uses the preferred company static files for
> just that user?
>
> Maybe instead, there is a company specific preference I can establish
> to provide '/static/admin_1.8' for that user?
>
> Maybe I need to have company-specific Admin templates which override
> the block which reads the static files based on a company preference?
>
> Any hints?
>
> Thanks
>
> Mike
>

--
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+unsubscribe@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/a1d84a3a-049b-4ba4-9641-579dab3e5f53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Session Variables

Please stop spreading FUD like this. The Django Community Code of Conduct isn't a blunt instrument attempting to stop all dissent or disagreement. It's there to ensure that everyone treats everyone else with respect in all communications. 

The fact that Daniel criticised Hungarian notation is in *no* way a violation of the CoC. It's fine to have opinions about Hungarian notation (or any other technology or stylistic choice, for that matter). However, the dismissive and contemptuous tone he used to voice his disapproval *is* a likely violation of the CoC. 

So - go right ahead and have opinions. Just choose your words when you voice them, and remember: we're all humans; we can all have different opinions and preferences; and there may be situations and circumstances that affect those choices that aren't always obvious on first inspection.

Yours,
Russ Magee %-)

On 31 May 2017, 4:08 AM +0800, ludovic coues <couesl@gmail.com>, wrote:
Pretty sure the django code of conduct is against criticizing the use
of Hungarian notation.

2017-05-29 12:29 GMT+02:00 Daniel Roseman <daniel@roseman.org.uk>:
On Monday, 29 May 2017 06:04:02 UTC+1, James Schneider wrote:


On May 28, 2017 9:35 AM, <yeddu.j...@gmail.com> wrote:


tFetchData = users.objects.get(emailid = lEmailId)

request.session['sPassword'] = tFetchData.userroles
request.session['sCompanyId'] = tFetchData.companyid

This code didn't appear to have anything to do with your question.


Also, Hungarian notation? Really?


--
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+unsubscribe@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/5427f3fe-4345-41b4-9a46-c0b037ece73b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Ludovic Coues
+33 6 14 87 43 42

--
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+unsubscribe@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/CAEuG%2BTZWJo3kX3AjFR_Lkf7JRkkVVjwrTMTQo9KkKZjmMoFZxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django db backend not FIPS compliant

This usage generates a short, unique identifier for a database index name. The usage of md5 here isn't security sensitive. Changing it to some other hash could be backwards incompatible because Django would no longer know the names of indexes in existing projects. There are other usages of md5 in Django where a short, fast hash is needed. I'm not sure if prohibiting the usage of md5 in Django or adding a setting to allow selecting some other hash in all those places is worth the additional complexity but you could write to django-developers to get other opinions.

On Tuesday, May 30, 2017 at 4:21:24 PM UTC-4, Brandon Williams wrote:
I'm running into issues when trying to migrate my models in an environment that is running FIPS restrictions regarding MD5.  Here is the stack trace:

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, dashboard, kombu_transport_django, sessions
Running migrations:
  Applying contenttypes.0001_initial...Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/usr/lib64/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/usr/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/lib64/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/lib64/python2.7/site-packages/django/db/migrations/operations/models.py", line 532, in database_forwards
    getattr(new_model._meta, self.option_name, set()),
  File "/usr/lib64/python2.7/site-packages/django/db/backends/base/schema.py", line 333, in alter_unique_together
    self.execute(self._create_unique_sql(model, columns))
  File "/usr/lib64/python2.7/site-packages/django/db/backends/base/schema.py", line 913, in _create_unique_sql
    "name": self.quote_name(self._create_index_name(model, columns, suffix="_uniq")),
  File "/usr/lib64/python2.7/site-packages/django/db/backends/base/schema.py", line 819, in _create_index_name
    index_unique_name = '_%s' % self._digest(table_name, *column_names)
  File "/usr/lib64/python2.7/site-packages/django/db/backends/base/schema.py", line 123, in _digest
    h = hashlib.md5()
ValueError: error:060800A3:digital envelope routines:EVP_DigestInit_ex:disabled for fips


 Is there a particular reason why MD5 is used here? Is there any harm in changing it to sh512 or something similar?

--
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+unsubscribe@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/7cea0860-3e9f-412c-8dec-2a4bb4766010%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.