Sunday, April 30, 2017

Different models in child and Parent Templates

I am using parent template as base which has a side nav bar. the child template keeps changing with clicking of buttons.
 
My child template changes correctly with call to different views through the URLs.

Now I want to add some data from model i the parent template irrespective of the view/model  or URL being called in the child template.

is there any easy was to do this.

for now I am writing additional context variables for parent template for all the child views. But this is not feasible

--
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/1f158305-4841-49ff-b2c8-9e2352418283%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: After upgrading 1.1 to 1.6 users with old passwords can log on new users can not log on.

Hi,

This explains your issue in detail:


..and talks about a very easy workaround

Mike

On Sun, Apr 30, 2017 at 4:25 PM, NoviceSortOf <dljonsson2008@gmail.com> wrote:


After upgrading from 1.1 to 1.6  all of our older registrants can logon but
new registrants can not using their new passwords.

Its as if Django will read the old passwords, but somehow it no longer
encrypts new passwords that are readable. 

I do see a structural difference in the new passwords

The old passwords looked like this
sha1$c9289$7c6d5430101f10bab8fe5f1991fcaaa7630b36b1

the new passwords look like this

pbkdf2_sha256$12000$joygsrjfs4s8$hL3Fo+g3DxWgZkgZEGonVXJzo+EWm7AuYjA39IAlMNo=

It appears to be in order to be backwards compatible somewhere in Django I need to switch
back to the whatever was creating the sha passwords.

Where in the can I do that?

Please advise 

--
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/2930ae48-8614-40ec-8895-e406cf5cf08f%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+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/CAAuoY6OP9N5h11ciPLofrGFSYFrn6pJhN4Okkdn%3DKbzTVyr_zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

After upgrading 1.1 to 1.6 users with old passwords can log on new users can not log on.



After upgrading from 1.1 to 1.6  all of our older registrants can logon but
new registrants can not using their new passwords.

Its as if Django will read the old passwords, but somehow it no longer
encrypts new passwords that are readable. 

I do see a structural difference in the new passwords

The old passwords looked like this
sha1$c9289$7c6d5430101f10bab8fe5f1991fcaaa7630b36b1

the new passwords look like this

pbkdf2_sha256$12000$joygsrjfs4s8$hL3Fo+g3DxWgZkgZEGonVXJzo+EWm7AuYjA39IAlMNo=

It appears to be in order to be backwards compatible somewhere in Django I need to switch
back to the whatever was creating the sha passwords.

Where in the can I do that?

Please advise 

--
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/2930ae48-8614-40ec-8895-e406cf5cf08f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Why do I get this error "context must be a dict rather than Context." ?

Thank you very much.

On Saturday, April 29, 2017 at 2:44:57 PM UTC-7, Pubudu Goonetilleke wrote:

My code : I am following tutorial on Django site and this is where I got stuck

"current_datetime"
I am not sure why I get the Type Error at line 20. Its same as tutorial. 


When I run the server, I get the following error : 

TypeError at /time/

context must be a dict rather than Context.
Request Method:GET
Request URL:http://127.0.0.1:8000/time/
Django Version:1.11
Exception Type:TypeError
Exception Value:
context must be a dict rather than Context.
Exception Location:D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\template\context.py in make_context, line 287
Python Executable:D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\python.exe
Python Version:3.6.1
Python Path:
['C:\\Users\\Pubudu\\workspace\\hello',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\python36.zip',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\DLLs',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\lib',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages']
Server time:Sat, 29 Apr 2017 21:35:31 +0000

Traceback Switch to copy-and-paste view

  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py in inner
    1.             response = get_response(request)
      ...
  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = self.process_exception_by_middleware(e, request)
      ...
  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)


--
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/cd46c770-0d77-4010-ba39-515c58df2bf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Tutorial | sqlmigrate command ending in error

You haven't given nearly enough information to help you. You need at least to post the contents of your polls/migrations/0001_initial.py, and your DATABASES settings.
--
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+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/1bf9059a-082f-4dcd-8f15-816ee598b9e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Error was: cannot import name 'GDALRaster in Window 8.1

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'django_extensions',
'rest_framework',
'corsheaders',
'casino_finder',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'casino_locater.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'casino_locater.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'casino_locater',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
}


# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/


BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'

STATICFLIES_DIR = (
os.path.join(BASE_DIR, 'static')
)

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
C:\User\.........\Desktop\Geolocation>python manage.py makemigrations
Traceback (most recent call last):
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\db\utils.py", line 115, in load_backend
    return import_module('%s.base' % backend_name)
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 677, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\contrib\gis\db\backends\postgis\base.py", line 7, in <module>
    from .operations import PostGISOperations
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\contrib\gis\db\backends\postgis\operations.py", line 7, in <module>
    from django.contrib.gis.gdal import GDALRaster
ImportError: cannot import name 'GDALRaster'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\core\management\__init__.py", line 337, in execute
    django.setup()
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\apps\registry.py", line 108, in populate
    app_config.import_models()
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\apps\config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 677, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\contrib\auth\models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\contrib\auth\base_user.py", line 52, in <module>
    class AbstractBaseUser(models.Model):
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\db\models\base.py", line 124, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\db\models\base.py", line 330, in add_to_class
    value.contribute_to_class(cls, name)
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\db\models\options.py", line 214, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\db\__init__.py", line 33, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\db\utils.py", line 211, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "C:\Users\Prashant\Desktop\Geolocation\casino_locater\lib\site-packages\django\db\utils.py", line 134, in load_backend
    raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'django.contrib.gis.db.backends.postgis' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
    'mysql', 'oracle', 'postgresql', 'sqlite3'
Error was: cannot import name 'GDALRaster'

--
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/685aa07a-b912-4945-9494-60991791ba89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

about tutorial "app reusable section" issue

Hi Django experts,

I'm new to django. I followed up the tutorial and everything is right on the way until the re-use app section. According to the tutorial, after packaging and installing the polls app using pip, I removed the directory 'polls' in 'mysite'. Then when I try to run "python manage.py runserver", it reported error as "No module named 'polls'". I just do exactly the same things as the tutorial said, could any one share me with some experience about the root cause?

thank you in advance!!

xuanbei

--
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/9e719510-613d-42a8-9250-9c058d5b3ad3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Tutorial | sqlmigrate command ending in error

Can anyone kindly help me on this issue?

Thanks,
Nikhil

On Friday, 21 April 2017 18:40:43 UTC+5:30, Nikhil Reddy wrote:
Hi,

I am going through this tutorial. When I execute the command: "python manage.py sqlmigrate polls 0001" it is ending in below error.
Please help resolve the issue.

Error:
Traceback (most recent call last):    File "manage.py", line 22, in <module>      execute_from_command_line(sys.argv)    File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line      utility.execute()    File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute      self.fetch_command(subcommand).run_from_argv(self.argv)    File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv      self.execute(*args, **cmd_options)    File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/commands/sqlmigrate.py", line 33, in execute      return super(Command, self).execute(*args, **options)    File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute      output = self.handle(*args, **options)    File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/commands/sqlmigrate.py", line 62, in handle      sql_statements = executor.collect_sql(plan)    File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/db/migrations/executor.py", line 219, in collect_sql      with self.connection.schema_editor(collect_sql=True, atomic=migration.atomic) as schema_editor:    File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py", line 25, in __enter__      self._initial_pragma_fk = c.fetchone()[0]  TypeError: 'NoneType' object has no attribute '__getitem__'  

Versions:
Python 2.7.13
Django 1.11
sqlite3 2.6.0

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+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/c2854687-dced-4527-90e9-2c0de618b92e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: django formset

I think you can select the field by class. Or $('name$=-fieldname')
On Fri, 28 Apr 2017 at 19:15 shahab emami <royaramezan@gmail.com> wrote:
hello
i search for my question on google and this group by i couldn't find the answer.
maybe I am not a good searcher.D

i have a formset.
there is a field for birth date in my form then as you know there are a few birth date field in my formset. I use this jquery plugin to add form dynamically:

https://github.com/elo80ka/django-dynamic-formset

every thing is good until now.  but because I have a date field in my form i want to

use this jquery plugin :

Datepicker | jQuery UI



then user can select date from this calendar .
but i don't now the id of date field in the form.
how can i select it with jquery  when i don't now the id of it?
I tried to find it with inspect element but i understood the id is different in every form. 
if you can tell me the idea to solving this problem or
introduce somewhere that i can read about this i will be thankful.


--
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/26a172d0-cd75-45e3-aa0c-f795dd40d754%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+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/CAATL4yxHNnBESuaFRW4skObCkjTpuBLe3%2B%2B_TD%3DbmOjjCp5M6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Saturday, April 29, 2017

Re: django formset

somebody had my problem before:

https://github.com/elo80ka/django-dynamic-formset/issues/108

please tell me something about this problem i cant solve if yet

On Friday, April 28, 2017 at 3:45:10 PM UTC+4:30, shahab emami wrote:
hello
i search for my question on google and this group by i couldn't find the answer.
maybe I am not a good searcher.D

i have a formset.
there is a field for birth date in my form then as you know there are a few birth date field in my formset. I use this jquery plugin to add form dynamically:

https://github.com/elo80ka/django-dynamic-formset

every thing is good until now.  but because I have a date field in my form i want to

use this jquery plugin :

Datepicker | jQuery UI



then user can select date from this calendar .
but i don't now the id of date field in the form.
how can i select it with jquery  when i don't now the id of it?
I tried to find it with inspect element but i understood the id is different in every form. 
if you can tell me the idea to solving this problem or
introduce somewhere that i can read about this i will be thankful.


--
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/7731176e-4be8-4f41-88ae-52fded5b1a22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Why do I get this error "context must be a dict rather than Context." ?

It looks like the tutorial you're following hasn't been updated for Django 1.11.

Line 20 should pass a dict rather than Context:

t.render({'current_date': now})

It's related to this change in Django 1.11: https://docs.djangoproject.com/en/dev/releases/1.11/#django-template-backends-django-template-render-prohibits-non-dict-context

On Saturday, April 29, 2017 at 5:44:57 PM UTC-4, Pubudu Goonetilleke wrote:

My code : I am following tutorial on Django site and this is where I got stuck

"current_datetime"
I am not sure why I get the Type Error at line 20. Its same as tutorial. 


When I run the server, I get the following error : 

TypeError at /time/

context must be a dict rather than Context.
Request Method:GET
Request URL:http://127.0.0.1:8000/time/
Django Version:1.11
Exception Type:TypeError
Exception Value:
context must be a dict rather than Context.
Exception Location:D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\template\context.py in make_context, line 287
Python Executable:D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\python.exe
Python Version:3.6.1
Python Path:
['C:\\Users\\Pubudu\\workspace\\hello',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\python36.zip',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\DLLs',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\lib',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages']
Server time:Sat, 29 Apr 2017 21:35:31 +0000

Traceback Switch to copy-and-paste view

  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py in inner
    1.             response = get_response(request)
      ...
  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = self.process_exception_by_middleware(e, request)
      ...
  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)


--
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/8456cbd1-4652-4e1c-86a8-f4127e7f3ec5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Why do I get this error "context must be a dict rather than Context." ?

My code : I am following tutorial on Django site and this is where I got stuck

"current_datetime"
I am not sure why I get the Type Error at line 20. Its same as tutorial. 


When I run the server, I get the following error : 

TypeError at /time/

context must be a dict rather than Context.
Request Method:GET
Request URL:http://127.0.0.1:8000/time/
Django Version:1.11
Exception Type:TypeError
Exception Value:
context must be a dict rather than Context.
Exception Location:D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\template\context.py in make_context, line 287
Python Executable:D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\python.exe
Python Version:3.6.1
Python Path:
['C:\\Users\\Pubudu\\workspace\\hello',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\python36.zip',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\DLLs',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\lib',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages']
Server time:Sat, 29 Apr 2017 21:35:31 +0000

Traceback Switch to copy-and-paste view

  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py in inner
    1.             response = get_response(request)
      ...
  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = self.process_exception_by_middleware(e, request)
      ...
  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)


--
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/13acc1ea-9461-45a1-96bc-a266e5e3f0a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Having problem with django runserver not working in windows 7

Do you mind sharing the full error you got ?

2017-04-29 5:46 GMT+02:00 Andrew James <gundampc@gmail.com>:
> Hi I'm new to django and I'm having a problem with getting django runserver
> to work. I'm new to django framework and I'm using windows 7. This is what
> I've tried so far that I've installed django. I've installed that django in
> my p drive. and I've tried the path in cmd like p:/python/mysite/manage.py
> runserver and I got error. I'm been frustrated with getting the django
> framework to work even though its already install. i did my best to follow
> the documentation direction. If there is a video instruction it would be
> nice.
>
> --
> 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/00435878-58e1-46d9-b068-9ed562a4038b%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%2BTYhRvAJDS5K0sYqC2cYhZ8fXdZbbbgG2UcRP_5PKAqQ8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Change password using django ADMIN

Do you mind sharing your urls.py files and the files used to generate that URL ?

On 28 Apr 2017 1:20 pm, "Reynaldo Bernard" <reynaldobernard15@gmail.com> wrote:
When i change LANGUAGE_CODE = 'en-us' to 'es-mx' and i try to change password from USER TABLE (default in Django) i got the next error


Check this video to see it : https://youtu.be/hWffzWEr5oQ


Note: Looks like 2/change is the problem. 


--
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/0001d0f4-cec5-4f0b-a552-dd014f1de297%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+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%2BTaGi21pUUuWYEJPJhFjpZrgefFhCF9kmHvAs15XJNiVTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

how to run a method background?

Hello all,

I am using apscheduler develop a timer, since the scheduler.state must equals '1' all scheduled jobs which storged in database will be triggered, so I need run scheduler.start() in background and let scheduler.state always equals '1', then all scheduled jobs will be triggered.

So can anyone tell me put scheduler.start() in which file can let it running background?

Am I clearly?

Many thanks for any help.

--
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/ae5ad44c-4263-4327-b084-232c2f569880%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Friday, April 28, 2017

Re: Displaying single-line progress while a management command runs

> Makes it easy to display a command line progress bar but, again, I end up with loads of progress bars displaying in my test output, and I assume it'll do the same when scheduling the task to run 

You can try a module I made to avoid this particular issue in django management command - https://pypi.python.org/pypi/django-tqdm 

On Monday, May 23, 2016 at 6:45:41 AM UTC-4, Phil Gyford wrote:
Belated thanks for this Erik - that does work nicely. It gets complicated/annoying trying to untangle other kinds of logging too, including logging from third-party modules, but that's a separate problem :)

On 9 May 2016 at 21:33, Erik Cederstrand <erik+...@cederstrand.dk> wrote:

> Den 9. maj 2016 kl. 14.23 skrev Phil Gyford <gyf...@gmail.com>:
>
> I have a custom management command which calls a method in another class, which fetches lots of data from a third-party API. Fetching the data could take a few seconds or it could take over an hour, depending on the quantity.
>
> [...]
> Things I've tried so far:
>
> 1) Using print(), e.g.:
>
>     print('Fetched %d of %d' % (n, total), end='\r')
>
> In a loop, this nicely shows a single line that constantly updates with progress. But print() is nasty and when I run my unit tests, this output is displayed among the testing output. I assume it'll also be a pain to have that output when running the commands scheduled with cron (or whatever).

I do this kind of progress reporting a lot. Usually, I get around the test/cron output pollution by adding a 'silent' argument to the management command which determines if the commend should print progress reports or not. See below.

> 2) Using Django logging. This is "better" than print(), and doesn't mess up test output, but as far as I can tell there's no way to display a single, constantly updated, line showing progress. It's only going to show one line after another:
>
>     Fetched 1 of 3000
>     Fetched 2 of 3000
>     Fetched 3 of 3000

It's actually quite simple. You need to create a custom handler like so:

  import logging
  import time
  from django.core.management.base import BaseCommand

  class OverwriteHandler(logging.StreamHandler):
      # The extra spaces wipe previous output in case your messages are wariable-width
      terminator = ' '*80 + '\r'

  log = logging.getLogger('')
  h = OverwriteHandler()
  log.addHandler(h)

  class Command(BaseCommand):
    def handle(self, silent=False, **options):
      log.setLevel(logging.DEBUG if silent else logging.INFO)
      log.info('1 of 2')
      time.sleep(1)
      log.info('2 of 2')
      time.sleep(1)

If you want to mix normal and progress logging in your management command, you need to use two loggers with different handlers.

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...@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/463A7786-888C-4CB0-9C68-43F855401924%40cederstrand.dk.
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/f884503b-6567-45f4-b8c1-5a1a5387453a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Having problem with django runserver not working in windows 7

Hi I'm new to django and I'm having a problem with getting django runserver to work. I'm new to django framework and I'm using windows 7. This is what I've tried so far that I've installed django. I've installed that django in my p drive. and I've tried the path in cmd  like p:/python/mysite/manage.py runserver and I got error. I'm been frustrated with getting the django framework to work even though its already install. i did my best to follow the documentation direction. If there is a video instruction it would be nice.

--
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/00435878-58e1-46d9-b068-9ed562a4038b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Channels App Design

Hi Ethan,

Distributed collaboration is kind of a generally unsolved problem, so there's no real best approach for what you have here. Having each environment assigned to a single process (worker) definitely helps keep things in shape, and if it's working for you, then I'd keep going with it.

My personal approach would be to instead use a database and log every change to an environment in an append-only format to that database, sending signals on each change that prompts updates to be sent down to clients, which can then be batched by querying the database based on revision number (if the environments are small enough they can be stored on a single server). This has the advantage that you can just "queue up" update transmissions and send them less often (maybe once a second) rather than every change, as you can just keep track of what the last revision each client saw was and send them anything newer. I'm not quite sure if I'd use a sorted set in Redis for this or just a postgres table (probably the latter, with good indexes?)

You might want to do some research into the mechanisms that power things like Google Docs collaborative editing; this is a similar type of problem. Certainly, using sessions for this kind of heavy lifting will be expensive to run.

Andrew

On Fri, Apr 28, 2017 at 10:23 AM, Ethan Knapp <ethank12345@gmail.com> wrote:
As background, I am developing a web app that implements Channels in what seems like an unusual way, so I want to do some validation and ask some opinions and suggestions. The application allows multiple users to work together in the same 3D environment (using Three.js on the client), being able to see each other and work together on the model.

I have established that keeping some data regarding the group of users stored in active memory on the app server is necessary. My initial thought was to create a Session object that tied into a Channels Group, but even with a Redis session backend, I can see that becoming very inefficient to request and hydrate the session out of Redis for every message received from a client WebSocket (Is this assertion correct?). My current implementation uses a custom Worker that can be assigned multiple groups of users (each group hereafter called an Environment). An instance of an Environment is only ever handled by one Worker, while a Worker can handle multiple Environments. A consumer within a normal Django-Channels app accepts messages on websocket.connect, websocket.receive, websocket.disconnect, and forwards them to the appropriate worker (each worker is assigned a unique channel), where the worker decides which Environment the message was intended for, and passes it. The Environment may then do whatever it needs to, including return a reply message to send back to the client via WebSocket (directly to the interface server via reply_channel).

My question is: "Is this the best design, or should I consider something else?" I am unsure of whether having one Channel per Worker is ideal, or if I should just give each Environment a unique channel (my idea here is that I only need to receive once per worker instead of n times). I also may need to give each Environment a tick loop beyond just responding to Channels events (likely, but undetermined) (honestly it's starting to feel more like a game/game server pair than a web app! [Considerations of a Java backend here?]). Also, does this fall within the use of Channels, or should I seriously consider using something like RabbitMQ directly, instead of possibly just using it as a Channels backend?

Thanks in advance for any advice or thoughts!
Ethan

--
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/35e1bed1-c2ce-456f-8770-f9eca719dd50%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+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/CAFwN1urA1WaArO%2BXNd%3DRscL1dGCBLvr%3DMgPWhZ8f7fW%2BuqHBzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.