Thursday, February 28, 2019
Why are foreign keys rewritten when adding related_name?
"django-admin sqlmigrate" what would be done.
It seems that the foreign key constraint is dropped, then the exact
same constraint is added back. Why?
Example: If we have the classes:
class Wall(models.Model):
..
class Door(models.Model):
..wall = models.ForeignKey(Wall)
and change Door.wall to models.ForeignKey(Wall, related_name='walls'), then:
Prior to this, there exist (postgres) the constraint:
"app_door_wall_id_45647_fk_app_wall" FOREIGN KEY (wall_id) REFERENCES
app_wall(id) DEFERRABLE INITIALLY DEFERRED.
"django_admin sqlmigrate" reports:
SET CONSTRAINTS "app_door_wall_id_45647_fk_app_wall" IMMEDIATE; ALTER
TABLE "app_door" DROP CONSTRAINT
"app_door_wall_id_45647_fk_app_wall";
ALTER TABLE "app_door" ADD CONSTRAINT
"app_door_wall_id_45647_fk_app_wall" FOREIGN KEY ("wall_id")
REFERENCES "app_wall" ("id") DEFERRABLE INITIALLY DEFERRED;
After running the migration, which is run as there's stuff in the log,
there exists seemingly the same constraint as before:
"app_door_wall_id_45647_fk_app_wall" FOREIGN KEY (wall_id) REFERENCES
app_wall(id) DEFERRABLE INITIALLY DEFERRED.
Why waste a connection this way?
--
HM
--
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/CACQ%3DrrdbgWpcSgm85fDDskWNRXvYQ5hGyyo9yn5T5fyRj7%2BPQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: Tutorials Needed
On Friday, March 1, 2019 at 11:29:37 AM UTC+8, Pradeep Singh wrote:
bro i have django & python videos + materialsOn Fri, 1 Mar 2019 at 04:04, Motaz Hejaze <trapp...@gmail.com> wrote:Why dont you google whatever you want ؟؟؟!!!--On Thu, 28 Feb 2019, 22:49 Lutalo Bbosa joseph, <bbo...@gmail.com> wrote:try introduction to python by sentdex on youtube--On Thu, Feb 28, 2019 at 9:54 PM Madhav Rajmohan <madhavr...@gmail.com> wrote:--Friends,I am Madhav Rajmohan currently pursuing my Studies in Computer Science, I Need some good beginners Tutorial for Django.And at the same time some tutorials for advanced python
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/c98acb13- .6845-4fc2-856c-cc11757d40ab% 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/CAMz%3Dh% 3DQvmmmrjX4qj9_ DxTTXVX3LcnprdX-V4e% 2Bgwp0MFJxy2Q%40mail.gmail.com .
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@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/CAHV4E- .fVQUBAC8mEJkm03PQW% 2B8PVGqZThi9SgcOgQjM0Dxd2qg% 40mail.gmail.com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+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/a1fd44c8-fbd1-4ede-8d2c-fbf12425776c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: Tutorials Needed
Why dont you google whatever you want ؟؟؟!!!--On Thu, 28 Feb 2019, 22:49 Lutalo Bbosa joseph, <bbosalj@gmail.com> wrote:try introduction to python by sentdex on youtube--On Thu, Feb 28, 2019 at 9:54 PM Madhav Rajmohan <madhavrajmohan@gmail.com> wrote:--Friends,I am Madhav Rajmohan currently pursuing my Studies in Computer Science, I Need some good beginners Tutorial for Django.And at the same time some tutorials for advanced python
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/c98acb13-6845-4fc2-856c-cc11757d40ab%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/CAMz%3Dh%3DQvmmmrjX4qj9_DxTTXVX3LcnprdX-V4e%2Bgwp0MFJxy2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+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/CAHV4E-fVQUBAC8mEJkm03PQW%2B8PVGqZThi9SgcOgQjM0Dxd2qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+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/CANwgZcZoZSY7QHKZkR2VYoVKDFY6Sd50CVkvW2_9Razv%2BVOHZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: 'URLPattern' Object is not a mapping
--umm
On Tuesday, February 26, 2019 at 6:06:20 PM UTC+5:45, Tina Upadhyay wrote:Getting this error and the urls.py of my model is as shown below:from django.conf.urls import urlfrom new import viewsapp_name = 'new'urlpatterns = [url(r'^export/csv/$', views.export_users_csv, name='export_users_csv'),# url(r'^$', views.upload, name='uplink'),url(r'^download/(.*)', views.download, name="download"),url(r'^download_attachment/(.*)/(.*)', views.download_as_attachment,name="download_attachment"),url(r'^exchange/(.*)', views.exchange, name="exchange"),url(r'^parse/(.*)', views.parse, name="parse"),url(r'^import/', views.import_data, name="import"),url(r'^import_sheet/', views.import_sheet, name="import_sheet"),url(r'^export/(.*)', views.export_data, name="export"),url(r'^handson_view/', views.handson_table, name="handson_view"),# handson table viewurl(r'^embedded_handson_view/',views.embed_handson_table, name="embed_handson_view"),url(r'^embedded_handson_view_single/',views.embed_handson_table_from_a_single_table,name="embed_handson_view"),# survey_result# url('^survey_result/',# views.survey_result, name='survey_result'),# testing purposeurl(r'^import_using_isave/',views.import_data_using_isave_book_as),url(r'^import_sheet_using_isave/',views.import_sheet_using_isave_to_database),url(r'^import_without_bulk_save/',views.import_without_bulk_save, name="import_no_bulk_save")]
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/8a4bb715-ba69-43b8-abe7-78daee9a0dd2%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/CA%2BWoneZhNr%3DuxZscoTye8dLJY7NmiZ-2_D5UT5reFyo83npOFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: Problems with first program
> hey guys I'm beginner on django I never worked with this framework
> before and then I've problems to started polls app this is the error:
>
deleting most of the traceback since in this case it is not relevant.
> File "/home/edvani/django-test/djangoproject/polls/models.py", line 5
> question_text = models.CharField(max_length=200)
> ^
> IndentationError: expected an indented block
>
Here is the head of models.py, as copied from the tutorial
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
Your copy of that file is different. Statement that end in : must be
followed by at least one indented line. These are known as "compound
statements" (if, elif, else, while, for, try, except, finally, with).
--
Bob Gailer
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
--
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/580f4cd8-1d87-56a0-7548-c20e26e3e446%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: ANN: django-yamlconf 1.0.0
--Hi Folks,
The package Django-yamlconf 1.0.0 has been uploaded to pypi. There are a number of YAML (and other formats) support modules for managing Django settings. The main difference here is:
- The directory tree is used to store multiple YAML config files with definitions higher up the tree over-riding definitions lower down (intent being a committed version for development values, production settings being in, e.g., "/var/myapp" or mapped into a container).
- The settings that can be adjust is not constrained: simply add a definition to a YAML file loaded and it's available as a setting (the setup is an import and a load at the end of the settings file)
- Can set elements within dictionaries in the settings using a dot'ed notation, e.g., DATABASES.default.NAME: mydb
- For debugging purposes, a view is available which can be added to the supported URLs
For more information and deeper documentation, see the GitHub page,
https://github.com/vmware/django-yamlconf
Feedback, bug reports, etc., are welcome.
Take care,
Michael.
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/7db78e8c-d965-4d7f-8067-826468227b6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
mrohan@acm.org
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/CAOCsNFhY_Ge0v95%2B-foVznKF6PUWa8eqxZ76OX_zscMt%2B-av3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Problems with first program
Traceback (most recent call last):
File "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
app_config.import_models()
File "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/edvani/django-test/djangoproject/polls/models.py", line 5
question_text = models.CharField(max_length=200)
^
IndentationError: expected an indented block
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/5df4e07d-d178-45c5-b58f-c34d8d6fb7cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: How to override the ModelAdmin "change" form ?
Hi,
I'm currently struggling with a custom ModelAdmin.
Karim
I haven't tried to fully understand your use case. However, this is what I think your process could be if you do not wish to ajax it ...
1. Override the model save() method to call a model method which detects your trigger scenario and calls the code you wish to execute to collect all the data you wish to display. This might be in the parent model or the m2m 'through' model. Unlikely to be in the child model.
2. Write a Form to reveal the data you wish to display. It probably needs to be a ModelForm
3. Write a template for the data including any hidden fields for object pks and additionally consider calling {{ block.super }} to display inherited stuff if you are extending another template and using the same block. When I first started to work all this out I was able to get my form to appear at the top of the ModelAdmin form using block.super and spent a bit of time hiding the big red [Delete] button because it was too close to my big blue [Pay now] button. However, as I got deeper into it I somehow lost that and never got it back. I was so pleased with getting it working eventually that I persuaded myself I didn't really want it on the same page anyway. Your mileage may vary :) I think you need to hard-code the form in the ModelAdmin to get it appearing above everything else.
4. Write any necessary urls
5. Write a view to manipulate your data, based on the request and your form
6. Get the Admin to display it on demand. The first line of the change_view() method below initialises the ModelAdmin to do absolutely nothing different than usual. Nothing will happen unless the trigger is detected. Then finally call to super to resume the normal course of events when your code is complete. What follows is my own recent experience. The comments should tell you more than the code
def change_view(self, request, object_id, form_url='', extra_context=None):
""" self = SubstanceAdmin request = wsgi request object object_id = substance form_url = no idea! extra_context = dict of apps, models, admin_urls and permissions https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django. contrib.admin.ModelAdmin.change_view """ # Let the ModelAdmin resume normal operations with its own template self.change_form_template = None # queryset of m2m records from the 'through' table ingredients = Substance_Ingredients.objects.filter(substance_id=object_id) subscription = None for sm2mi in ingredients: # sm2mi.fee_payable() is the detector which triggers the process payable, fee_type = sm2mi.fee_payable() # eg., True, PAID_DATA if payable: # generate a subscription record with blank token field or # if one exists with a non-blank token, return None subscription = billing_subscribe(sm2mi, fee_type) if subscription: # collect money for the owner # switch the ModelAdmin to the new template self.change_form_template = 'payment.html' # assemble all the necessary data for the view context = billing_collect_context( sm2mi, subscription, ) # get everything into the payment_view context if not extra_context: extra_context = dict() extra_context.update(self.admin_site.each_context(request)) extra_context.update(context) # wrap the view to protect it with Admin permissions self.admin_site.admin_view( # call the view with request and context billing_payment_view( request, sm2mi, subscription, context=extra_context, ) ) # only one sm2mi at a time break return super(SubstanceAdmin, self).change_view( request, object_id, form_url, extra_context )
7. Call super in the model save() method *or* raise an exception to prevent saving. I'm actually not sure about this bit. It may go against the Django flow. However, I do use a BusinessRuleViolation exception which inherits from ValidationError and therefore lets me include a human readable message which appears in the Admin and *seems* to prevent saving. You would need to test this especially with m2m side-effects and atomicity consequences.
I hope this helps.
Mike
--
Considering the following model:
# Bloc fonctionnel
class Assembly(Item):
product = models.ForeignKey(to='ProductFamily', on_delete=models.CASCADE, null=True, verbose_name=_('Famille Produit'))
functions = models.ManyToManyField(Function, verbose_name=_('Fonctions'))
performances = models.ManyToManyField(Performance, verbose_name=_('Performances'), related_name='performances')
def _get_type(self):
return ItemType.ASSEMBLY
class Meta:
verbose_name = _('Bloc Fonctionnel')
verbose_name_plural = _('Blocs Fonctionnels')
I have a custom AssemblyAdmin related to it and also a custom AssemblyForm for customizing some fieds.
The performances m2m field is critical.The performances are captured in the form with a dynamic_raw_id field, which works fine.
But when this field is modified, some updates/deletions might be applied in other tables of the database.For this purpose, I need to collect the "performance" pk captured in the html form and compare them with those currently in the database.
Basically, when the user clicks on the regular "Save" or "Save and continue" button, I would need to display an alert form (like when you click on the delete button) to explain what would happen.
I struggled with some ajax routines but it does not work as expected.
I don't know if it's really doable and how to achieve it.
Any suggestion is welcome.
Cheers.
Z.
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/88135218-a965-46c8-a454-c0376a5682f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
"onchange" event with "autocomplete_fields"
hello,
Into my admin site I have some Selects (from foreignKeys) for which I'm able to add a "change" event so that when I choose an option from the Select's dropdown somethings happens to the other fields via an AJAX request. I'm doing this using djquery, directly into the <script> section of my template.html with something such as $("#id_selector").on('change', myFunction() {......}
Now I wanted to do the same using an "Autocomplete_field" widget but I'm not able to add any "on" event via jquery, it seems they are ignored even if they appear into the HTML source page. But if I add this "onchange" as an attribute of the field's widget (e.g. form.base_fields['myField'].widget.attrib['onchange']='myUpdateFieldsFunction()' ) then it works.
Is this intended?
Thanks,
alaxa
Re: Tutorials Needed
try introduction to python by sentdex on youtube--On Thu, Feb 28, 2019 at 9:54 PM Madhav Rajmohan <madhavrajmohan@gmail.com> wrote:--Friends,I am Madhav Rajmohan currently pursuing my Studies in Computer Science, I Need some good beginners Tutorial for Django.And at the same time some tutorials for advanced python
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/c98acb13-6845-4fc2-856c-cc11757d40ab%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/CAMz%3Dh%3DQvmmmrjX4qj9_DxTTXVX3LcnprdX-V4e%2Bgwp0MFJxy2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+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/CAHV4E-fVQUBAC8mEJkm03PQW%2B8PVGqZThi9SgcOgQjM0Dxd2qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: Extract LineString in Geodjango
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/8a475605-a50e-4844-b3e3-315317995823%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: Django 1.11: AttributeError: 'module' object has no attribute 'setup_environ'
On Friday, 1 March 2019 06:41:55 UTC+11, Chi Shiek wrote:
This is related to a bug I raised against app engine while tying to migrate from django 1.5 to 1.11.The issue is I have an app running on app engine using django 1.5.Recently I was making a number of major updates to the app and decided to convert to django 1.11 as part of that update.Everything seemed to work fine on my local dev_appserver, but when I deployed it to app engine, it threw an error similar to this...
ERROR 2019-02-28 19:01:49,710 wsgi.py:263]Traceback (most recent call last):File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/ google_appengine/google/ appengine/runtime/wsgi.py", line 240, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler() ) File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/ google_appengine/google/ appengine/runtime/wsgi.py", line 299, in _LoadHandler handler, path, err = LoadObject(self._handler)File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/ google_appengine/google/ appengine/runtime/wsgi.py", line 96, in LoadObject __import__(cumulative_path)INFO 2019-02-28 19:01:49,720 module.py:861] default: "GET /Common?action=%5B%22logout%22%5D HTTP/1.1" 500 - File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/ google_appengine/google/ appengine/ext/django/main.py", line 82, in <module> management.setup_environ(settings, original_settings_path= settings_path) AttributeError: 'module' object has no attribute 'setup_environ'
I downloaded the app back to my local development server and built a clean python environment using only the exact modules I needed - and then I saw the same setup_environ error.The module indicated has the following code which is throwing the error.
try:
settings = __import__(settings_path)
management.setup_environ(settings, original_settings_path= settings_path)
except ImportError:
pass
I changed the code to
try:
settings = __import__(settings_path)
management.setup_environ(settings, original_settings_path= settings_path)
except AttributeError:
django.setup()
except ImportError:
pass
And everything works fine.My problem is that the changed module appears to be inside the google-cloud-sdk and therefore I cannot change it in production.My app.yaml point to django 1.11I've searched the net and no one seems to have encountered this problem before...there is a lot about setup_environ, but nothing that addresses this particular issue.I even raised a ticket against app engine (https://issuetracker.google.com/issues/124539522 ) but received a reply that it was a django problem.Question is - has anyone else come across this problem in the app engine environment - and how did you resolve it?Thanks!/Chi
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/8adf927f-30b7-4d91-8b20-33db30142bdd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: Django 1.11: AttributeError: 'module' object has no attribute 'setup_environ'
libraries:- name: django version: "1.11"
commented out these lines from my main.py
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")#from django.conf import settings
seems I had this in my app.yaml already
env_variables: DJANGO_SETTINGS_MODULE: 'core.settings'
That's about it...oh - also removed the changes I made to...
On Friday, 1 March 2019 06:41:55 UTC+11, Chi Shiek wrote:
This is related to a bug I raised against app engine while tying to migrate from django 1.5 to 1.11.The issue is I have an app running on app engine using django 1.5.Recently I was making a number of major updates to the app and decided to convert to django 1.11 as part of that update.Everything seemed to work fine on my local dev_appserver, but when I deployed it to app engine, it threw an error similar to this...
ERROR 2019-02-28 19:01:49,710 wsgi.py:263]Traceback (most recent call last):File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/ google_appengine/google/ appengine/runtime/wsgi.py", line 240, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler() ) File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/ google_appengine/google/ appengine/runtime/wsgi.py", line 299, in _LoadHandler handler, path, err = LoadObject(self._handler)File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/ google_appengine/google/ appengine/runtime/wsgi.py", line 96, in LoadObject __import__(cumulative_path)INFO 2019-02-28 19:01:49,720 module.py:861] default: "GET /Common?action=%5B%22logout%22%5D HTTP/1.1" 500 - File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/ google_appengine/google/ appengine/ext/django/main.py", line 82, in <module> management.setup_environ(settings, original_settings_path= settings_path) AttributeError: 'module' object has no attribute 'setup_environ'
I downloaded the app back to my local development server and built a clean python environment using only the exact modules I needed - and then I saw the same setup_environ error.The module indicated has the following code which is throwing the error.
try:
settings = __import__(settings_path)
management.setup_environ(settings, original_settings_path= settings_path)
except ImportError:
pass
I changed the code to
try:
settings = __import__(settings_path)
management.setup_environ(settings, original_settings_path= settings_path)
except AttributeError:
django.setup()
except ImportError:
pass
And everything works fine.My problem is that the changed module appears to be inside the google-cloud-sdk and therefore I cannot change it in production.My app.yaml point to django 1.11I've searched the net and no one seems to have encountered this problem before...there is a lot about setup_environ, but nothing that addresses this particular issue.I even raised a ticket against app engine (https://issuetracker.google.com/issues/124539522 ) but received a reply that it was a django problem.Question is - has anyone else come across this problem in the app engine environment - and how did you resolve it?Thanks!/Chi
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/a51c874b-1119-4e7e-930a-55228462a613%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Needs some debugging codes
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/928015a1-948f-489a-834f-2cee37ceacb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: Tutorials Needed
--Friends,I am Madhav Rajmohan currently pursuing my Studies in Computer Science, I Need some good beginners Tutorial for Django.And at the same time some tutorials for advanced python
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/c98acb13-6845-4fc2-856c-cc11757d40ab%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/CAMz%3Dh%3DQvmmmrjX4qj9_DxTTXVX3LcnprdX-V4e%2Bgwp0MFJxy2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Django 1.11: AttributeError: 'module' object has no attribute 'setup_environ'
ERROR 2019-02-28 19:01:49,710 wsgi.py:263]Traceback (most recent call last): File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler handler, path, err = LoadObject(self._handler) File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/google_appengine/google/appengine/runtime/wsgi.py", line 96, in LoadObject __import__(cumulative_path)INFO 2019-02-28 19:01:49,720 module.py:861] default: "GET /Common?action=%5B%22logout%22%5D HTTP/1.1" 500 - File "/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/google_appengine/google/appengine/ext/django/main.py", line 82, in <module> management.setup_environ(settings, original_settings_path=settings_path)AttributeError: 'module' object has no attribute 'setup_environ'
I downloaded the app back to my local development server and built a clean python environment using only the exact modules I needed - and then I saw the same setup_environ error.
try:
settings = __import__(settings_path)
management.setup_environ(settings, original_settings_path=settings_path)
except ImportError:
pass
I changed the code to
try:
settings = __import__(settings_path)
management.setup_environ(settings, original_settings_path=settings_path)
except AttributeError:
django.setup()
except ImportError:
pass
And everything works fine.
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/853d28f7-9eab-450f-81bf-f05343939da1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Learn Django Interactive Charts
I am new to Djanho Python.
I like to learn how to create interactive charts using d3.js, reactive application like dashboard.
I dont know how and where to start my application.
Can anyone direct me in right direction.
--
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/202564d7-36ad-417e-a69d-872aee3b92be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tutorials Needed
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/c98acb13-6845-4fc2-856c-cc11757d40ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Extract LineString in Geodjango
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/ac67ce96-1706-4d47-ac7f-1c153f6d48ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.