Re: setting up urls of many apps

2021-02-20 Thread Jorge Gimeno
On Wed, Feb 17, 2021 at 11:00 PM RANGA BHARATH JINKA <
bharathjink...@gmail.com> wrote:

> Hi,
>
> Please follow these docs
> https://docs.djangoproject.com/en/3.1/ref/urls/#include
>
> On Thu, Feb 18, 2021 at 12:12 PM Peter Kirieny 
> wrote:
>
>> if self.pattern.name is not None and ":" in self.pattern.name:
>> TypeError: argument of type 'type' is not iterable
>>
>> that's the error
>>
>> On Thu, 18 Feb 2021 at 09:39, Peter Kirieny 
>> wrote:
>>
>>> thanks sir
>>> that's done though the error still persists
>>>
>>> On Thu, 18 Feb 2021 at 09:32, RANGA BHARATH JINKA <
>>> bharathjink...@gmail.com> wrote:
>>>
 Hi,

 Please check namespace='core' in project urls.py. For shops app also
 namespace is same. Please change this namesapce to Shops.

 All the best

 On Thu, Feb 18, 2021 at 11:56 AM Peter Kirieny 
 wrote:

> in the projects urls.py
>
> from django.conf import settings
> from django.conf.urls.static import static
> from django.contrib import admin
> from django.urls import path, include
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('accounts/', include('allauth.urls')),
> path('', include('core.urls', namespace='core')),
> path('Shops/', include('Shops.urls', namespace='core')),
>
> ]
>
> if settings.DEBUG:
> import debug_toolbar
> urlpatterns += [path('__debug__/', include(debug_toolbar.urls))]
> urlpatterns += static(settings.MEDIA_URL,
>   document_root=settings.MEDIA_ROOT)
> urlpatterns += static(settings.STATIC_URL,
>   document_root=settings.STATIC_ROOT)
>
>
> in the app's urls.py
>
> from django.urls import path
> from .views import ShopsView
>
> app_name = 'Shops'
>
> urlpatterns = [
> path('Shops/', ShopsView.as_view(), name=ShopsView)
>
>
> On Wed, 17 Feb 2021 at 17:52, Nicolas nasr  wrote:
>
>> Can  you please show your urls.py file
>>
>> On Wednesday, February 17, 2021 at 8:31:50 AM UTC+2
>> kirien...@gmail.com wrote:
>>
>>> someone to help me to set up urls of two different apps in django
>>> project please, i keep on getting errors
>>> am new
>>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/635506c8-35bc-4c76-a937-c992dd1312dbn%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAL8t8eoNg68Qd%3DC3OYWonaLs%3DvAKcnzDFxxbrcNK65BJ%3DtnwnQ%40mail.gmail.com
> 
> .
>


 --
 Thanks and Regards

 J. Ranga Bharath
 cell: 9110334114

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

>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAL8t8epM3Y9_twr%2Bg83wkYXAaHCjD3MY03RY%2B28QS8BYO2DVEA%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Thanks and Regards
>
> J. Ranga Bharath
> cell: 9110334114
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving 

Re: Django Queryset

2020-12-13 Thread Jorge Gimeno
On Sun, Dec 13, 2020 at 7:21 PM MAMADOU KANTE  wrote:

> Hi to everybody;
> I have been trying to deploy an app through heroku for the past 7 days but
> whenever I reach the final stage  I receive a rejection message.
> The message tells me the module "skbuild" was not imported or I should
> upgrade my pip version. But when I check through the terminal
> I find that I can import skbuild and the latest version of pip is
> installed on the machine.
> I tried to deploy by linking my Github repository to heroku but I still
> receive the same error message as described below:
>
> Python app detected
>
>  ! Python has released a security update! Please consider upgrading to 
> python-3.9.1
>
>Learn More: https://devcenter.heroku.com/articles/python-runtimes
>
> -> Installing python-3.9.0
>
> -> Installing pip 9.0.2, setuptools 47.1.1 and wheel 0.34.2
>
> -> Installing dependencies with Pipenv 2018.5.18…
>
>Installing dependencies from Pipfile.lock (db603f)…
>
>An error occurred while installing opencv-python==4.4.0.46! Will try 
> again.
>
>Installing initially–failed dependencies…
>
>Traceback (most recent call last):
>
>  File "", line 1, in 
>
>  File "/tmp/pip-build-m9tvr4w5/opencv-python/setup.py", line 9, 
> in 
>
>import skbuild
>
>ModuleNotFoundError: No module named 'skbuild'
>
>Command "python setup.py egg_info" failed with error code 1 in 
> /tmp/pip-build-m9tvr4w5/opencv-python/
>
>You are using pip version 9.0.2, however version 20.3.1 is available.
>
>You should consider upgrading via the 'pip install --upgrade pip' 
> command.
>
> ! Push rejected, failed to compile Python app.
>
>  ! Push failed
>
> CAN ANYONE HELP?
>
>
I would start by upgrading pip (https://pypi.org/project/pip/).  Version
9.x was quite some time ago.  Also, pipenv's current version is 2020.11.15 (
https://pypi.org/project/pipenv/).

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK86JFm2RiEw0wu3T6%2B-bzPtZ5Yh-2ZosA928pgjOMifyA%40mail.gmail.com.


Re: No ID Error

2020-11-11 Thread Jorge Gimeno
Without any more context, a Google search brought up this:
https://stackoverflow.com/questions/55834107/django-template-library-invalidtemplatelibrary-invalid-template-library-specifi.
Hopefully that is helpful.

We would need the full trackback and the file where the error occurred to
be able to offer any more specific help.

-Jorge

On Tue, Nov 10, 2020 at 12:57 PM griffines onyango <
griffinesonya...@gmail.com> wrote:

>
> "trying to load '%s': %s" % (entry[1], e)
> django.template.library.InvalidTemplateLibrary: Invalid template library
> specified. ImportError raised when trying to load
> 'django.contrib.admin.templatetags.admin_static': cannot import name
> 'RemovedInDjango30Warning'
> griffins@bimasimple:~/Desktop/final/trial/Insurance-project-master$
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ee675b33-7bfd-4cef-9b1e-d435384d83cen%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-JK_zs26R%2B8AGQ%2BYL6V%2BbnuAAjoBQTRkvu%2BUkUaWk9yA%40mail.gmail.com.


Re: Was I supposed to be able to create a question on the website using 'runserver'?

2020-11-11 Thread Jorge Gimeno
That's a helper function to get the Question instances you need for
testing.  It's a way to query for those questions without repeating the
same code over and over in tests.

-Jorge

On Wed, Nov 11, 2020 at 5:56 AM Carlos Henrique <
carloshenrique...@poli.ufrj.br> wrote:

> I'm following this
> 
> Django tutorial. So far I haven't had an issue so far, but now I'm not
> really sure if I understood it correctly. We created a shortcut function to
> create questions, but I thought that it was meant to be user-side and when
> I use 'runserver', on the website there's no such option, only the
> previously created question. This is the code for the function:
> def create_question(question_text, days): """ Create a question with the
> given `question_text` and published the given number of `days` offset to
> now (negative for questions published in the past, positive for questions
> that have yet to be published). """ time = timezone.now() +
> datetime.timedelta(days=days) return
> Question.objects.create(question_text=question_text, pub_date=time)
>
> Did I get it wrong? This function is only admin-sided? It's on
> 'polls/test.py' and it's outside every class.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f4dfe964-3417-4605-af26-d99a0d8fa4b5n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_56zjpn9yO-BvT1ec9KOY%2BOSnnRyJL%2B5E49DHuZ8_fcg%40mail.gmail.com.


Re: Error on unauthorized access problem in django

2020-07-14 Thread Jorge Gimeno
django.contrib.staticfiles by design will serve static files only when
debug is set to False.  It's not designed to serve static files in a
production environment.  See here:
https://docs.djangoproject.com/en/3.0/howto/static-files/deployment/

-Jorge


On Mon, Jul 13, 2020 at 5:11 AM Anjana Balakrishnan <
anjanabalakrishnan1...@gmail.com> wrote:

> Hi,
>   i am in trouble with django unauthorized access problem.i have a django
> project and it is now ready for production,so i added debug=False in
> settings.py file.When i change the debug=false, unauthorized access issue
> is solved,but the problem is webpages can't access all css and js
> files(Static folder,)how can i solve tbis issue?Attached a document showing
> this problems.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2edb567b-0909-4381-a8d7-9634ae688df5o%40googlegroups.com
> 
> .
>

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


Re: Command open postgresql in from cmd in windows

2020-05-30 Thread Jorge Gimeno
Postgres on Windows may have a different story and user interface.  You may
need to use something like pAdmin to work with it.

-Jorge

On Sat, May 30, 2020 at 10:20 AM sunday honesty 
wrote:

> I have been in a message before I could successfully install postgresql on
> my windows; it seems everyone is using Linux or Mac.
>
> Pls can someone help me now...
> I want to open postgres she'll from my command prompt so I can continue
> what am learning... The Tutorial am following is using Linux and the
> command to "psql" to open shell is not working on my windows.
>
> Anybody please.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e2396f7b-9e27-442d-a2aa-302a089bead8%40googlegroups.com
> .
>

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


Re: TypeError: __init__() got an unexpected keyword argument 'Null'

2020-05-20 Thread Jorge Gimeno
Similar to keys in a dictionary, keyword argument names are case
sensitive.  Try to pass in the lowercase version 'null':

Raison_Non_Delivery_cd = models.ForeignKey(Raison,
on_delete=models.CASCADE, related_name='raisonNonDelivery', null=True)

-Jorge

On Wed, May 20, 2020 at 5:05 PM hajar  wrote:

> hello django users , I hope u r doing well !
>
>
> why can't I use Null in this case of foreign key , I hope you can see the
> picture below that's my class and the error
>
>
>
> [image: err.png]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ce736614-3ff9-47fa-885d-3f5b87160291%40googlegroups.com
> 
> .
>

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


Re: Reverse for 'display_data' not found. 'display_data' is not a valid view function or pattern name

2020-05-20 Thread Jorge Gimeno
On Tue, May 19, 2020 at 10:56 PM ratnadeep ray  wrote:

> Hi all,
>
> I am getting the below error when I am trying to load the home page:
> Reverse for 'display_data' not found. 'display_data' is not a valid view
> function or pattern name
>
> My views.py file is as follows:
>
>
>
>> def home(request):
>> #query_results = QRC_DB.objects.all()
>> return render(request, 'display_data.html')
>>
>> def display_data(request,component):
>> #query_results = QRC_DB.objects.all()
>> return HttpResponse("You're looking at the component %s." % component)
>
>
> My urls.py file under the app is as follows:
>
> from django.urls import path
> from fusioncharts import views
>
> urlpatterns = [
>> path('home/', views.home, name=''),
>> ]
>
>
> The urls.py file under the project is as follows:
>
> from django.contrib import admin
>> from django.urls import path,include
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', include('fusioncharts.urls'))
>> ]
>
>
>
> And my html file (display_data) code is as follows :
>
>>
>> {% block content %}
>>   Display the test results
>>   
>> 
>> SQL
>>   
>> {% endblock %}
>
>
>
>
> Can anyone please help me to find out the mistake ?
>
> Thanks.
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/31ce205c-b54c-484f-8928-350eb91178a6%40googlegroups.com
> 
> .
>

NoReverseFound is one of those exceptions that I need a mental mapping
for.  It's not necessarily easy to intuit the meaning from the name
itself.  What works for me is that Django is saying "You've given me a
named URL, and I can't find it."

In your template, there's a url tag. The first argument of a url tag is the
named url it should insert there.  You give the tag 'display_data', but
there is no urlpattern in either of your urls with the name set to
'display_data'.

In your fusioncharts/urls.py, I would add this (completely untested):

from django.urls import path
from fusioncharts import views

urlpatterns = [
> path('home/', views.home, name=''),
>
   *path('display_data//', views.display_data,
name='display_data'), # <- Added here!*

> ]


Now we have a path with the same name that your template is looking for,
you have a view it sends the data to, and you capture the variable that
will be sent to the view.

Hope this helps!

-Jorge

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


Re: PROBLEM WITH Multiple SETTINGS.PY FILE

2020-05-19 Thread Jorge Gimeno
I'm not sure why you're getting an exception.  I know the import mechanism
in Python 2 was a bit different, so I'm not sure if that's the issue or if
Django's import mechanism isn't finding your settings file.

I don't know if you have tried this, but I saw a blog post on using
multiple settings files.  Maybe it will help:
https://simpleisbetterthancomplex.com/tips/2017/07/03/django-tip-20-working-with-multiple-settings-modules.html

I hope this helps!

-Jorge

On Mon, May 18, 2020 at 6:51 PM chaitanya orakala 
wrote:

> I tried that way, sir. but it's of no use. I don't know how to resolve
> this issue. its been troubling me for 3 days now
>
> On Mon, May 18, 2020 at 9:29 PM Mike Dewhirst 
> wrote:
>
>> On 19/05/2020 11:10 am, chaitanya orakala wrote:
>> > I am using Python 2.7
>>
>> It is possible you need a top line in the file like this ...
>>
>> from __future__ import absolute_import
>>
>> I haven't been following this thread so someone may have mentioned that
>> already.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/95afb956-98f8-6664-9107-d0935b75cf6c%40dewhirst.com.au
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPcTzRZHgBG1Q90Rk8VmNS%2ByzmQLd1bdq8ZPgA6A%2Bumsx4CGvw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9MAMn3WezyhMU5Rrv5DWWFNxQ0jc9RnfyK-qyCOiV%2BeA%40mail.gmail.com.


Re: PROBLEM WITH Multiple SETTINGS.PY FILE

2020-05-16 Thread Jorge Gimeno
It's coming from your settings file.  I would try this:

In this line here:
elif HOST == "Sai" :
from settings_dev_sai import *

I would try to make the second line:
from .settings_dev_sai import *

See if Python can find the module that way.  If Python does, then all of
the imports in that file need to be changed.

If that's not the case, then we need to see what the directory structure
looks like to figure this out.

-Jorge

On Sat, May 16, 2020 at 4:04 PM chaitanya orakala 
wrote:

> Do you have any idea why i am getting this error?
>
> On Sat, May 16, 2020 at 6:40 PM chaitanya orakala <
> chaitu.orak...@gmail.com> wrote:
>
>> Yes Jorge, all the settings file are in the same folder
>>
>>
>> On Sat, May 16, 2020 at 5:20 PM Jorge Gimeno 
>> wrote:
>>
>>>
>>>
>>> On Sat, May 16, 2020 at 1:52 PM chaitan 
>>> wrote:
>>>
>>>> Hi, I am facing ModuleNotFoundError in my Django application. It got
>>>> configured with multiple settings files for production, Development &
>>>> Testing.
>>>> When I Try to run Python manage.py runserver --settings=
>>>> settings_dev_sai.
>>>>
>>>> This is My *Settings* File:
>>>>
>>>> import socket
>>>>
>>>> #import settings depending on the box we are on
>>>> HOST = socket.gethostname()
>>>> TPA_CODE = "Bridge"
>>>> TPA_NAME = "Bridge Benefits System"
>>>>
>>>> #development
>>>> if HOST == "BITS-DP-LAPTOP":
>>>> from settings_dev import *
>>>> TPA_NAME = "ICBA Benefit Services Ltd."
>>>> TPA_CODE = 'ICBA'
>>>> #DFG bridge
>>>> elif HOST == "dfginternal":
>>>> from settings_dfg_ees import *
>>>> TPA_NAME = "Dehoney Financial Group"
>>>> TPA_CODE = 'DFG'
>>>> #test
>>>> elif HOST == "DFGTEST02":
>>>> from settings_staging import *
>>>> elif HOST == "icbaweb":
>>>> from settings_production_icba import *
>>>> TPA_NAME = "ICBA Benefit Services Ltd."
>>>> TPA_CODE = 'ICBA'
>>>> elif HOST == "meritweb":
>>>> from settings_production_merit import *
>>>> TPA_NAME = "Ontario Construction Industry Benefit Plan"
>>>> TPA_CODE = 'MERIT'
>>>> elif HOST == "dfgweb" :
>>>> from settings_production_dfg import *
>>>> TPA_NAME = "Dehoney Financial Group"
>>>> TPA_CODE = 'DFG'
>>>> elif HOST == "dev" or HOST == "j-ubu" :
>>>> from settings_dev_baikal import *
>>>> elif HOST == "jdev" :
>>>> from settings_dev_juliab import *
>>>> elif HOST == "Sai" :
>>>> from settings_dev_sai import *
>>>> elif HOST == "johnstonesweb" :
>>>> from settings_production_johnstones import *
>>>> TPA_NAME = "Johnstone's Benefits"
>>>> TPA_CODE = 'JOHNSTONES'
>>>> elif HOST == "bridgedemo" :
>>>> from settings_demo import *
>>>> TPA_CODE = "Bridge"
>>>> TPA_NAME = "Bridge Benefits System"
>>>> else:
>>>> raise ImportError("This server's hostname [" + HOST + "] does not
>>>> have a proper expanded settings file. Please configure one.")
>>>> *
>>>>
>>>> This is my *settings_dev_sai*
>>>>
>>>> from settings_common import *
>>>>
>>>> DEBUG = True
>>>> RUN_TYPE = RUN_DEV
>>>>
>>>> DATABASES = {
>>>> 'default': {
>>>> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
>>>> #'NAME': 'bridge_icba',
>>>> 'NAME': 'bridge_js',
>>>> #'NAME': 'bridge_dfg_internal',
>>>> #'NAME': 'bridge_dfg',
>>>> 'HOST': 'localhost',
>>>> 'USER': 'django',
>>>> 'PASSWORD': 'bridge_user',
>>>> 'PORT': '',
>>>> },
>>>> }
>>>>
>>>> MEDIA_ROOT = 'C:/Users/DavidPiccione/Dropbox/Work -
>>>> Bridge/Projects/bridge/MEDIA/'
>>>> MEDIA_URL = '/media/'
>>>>
>&g

Re: PROBLEM WITH Multiple SETTINGS.PY FILE

2020-05-16 Thread Jorge Gimeno
On Sat, May 16, 2020 at 1:52 PM chaitan  wrote:

> Hi, I am facing ModuleNotFoundError in my Django application. It got
> configured with multiple settings files for production, Development &
> Testing.
> When I Try to run Python manage.py runserver --settings= settings_dev_sai.
>
> This is My *Settings* File:
>
> import socket
>
> #import settings depending on the box we are on
> HOST = socket.gethostname()
> TPA_CODE = "Bridge"
> TPA_NAME = "Bridge Benefits System"
>
> #development
> if HOST == "BITS-DP-LAPTOP":
> from settings_dev import *
> TPA_NAME = "ICBA Benefit Services Ltd."
> TPA_CODE = 'ICBA'
> #DFG bridge
> elif HOST == "dfginternal":
> from settings_dfg_ees import *
> TPA_NAME = "Dehoney Financial Group"
> TPA_CODE = 'DFG'
> #test
> elif HOST == "DFGTEST02":
> from settings_staging import *
> elif HOST == "icbaweb":
> from settings_production_icba import *
> TPA_NAME = "ICBA Benefit Services Ltd."
> TPA_CODE = 'ICBA'
> elif HOST == "meritweb":
> from settings_production_merit import *
> TPA_NAME = "Ontario Construction Industry Benefit Plan"
> TPA_CODE = 'MERIT'
> elif HOST == "dfgweb" :
> from settings_production_dfg import *
> TPA_NAME = "Dehoney Financial Group"
> TPA_CODE = 'DFG'
> elif HOST == "dev" or HOST == "j-ubu" :
> from settings_dev_baikal import *
> elif HOST == "jdev" :
> from settings_dev_juliab import *
> elif HOST == "Sai" :
> from settings_dev_sai import *
> elif HOST == "johnstonesweb" :
> from settings_production_johnstones import *
> TPA_NAME = "Johnstone's Benefits"
> TPA_CODE = 'JOHNSTONES'
> elif HOST == "bridgedemo" :
> from settings_demo import *
> TPA_CODE = "Bridge"
> TPA_NAME = "Bridge Benefits System"
> else:
> raise ImportError("This server's hostname [" + HOST + "] does not have
> a proper expanded settings file. Please configure one.")
> *
>
> This is my *settings_dev_sai*
>
> from settings_common import *
>
> DEBUG = True
> RUN_TYPE = RUN_DEV
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> #'NAME': 'bridge_icba',
> 'NAME': 'bridge_js',
> #'NAME': 'bridge_dfg_internal',
> #'NAME': 'bridge_dfg',
> 'HOST': 'localhost',
> 'USER': 'django',
> 'PASSWORD': 'bridge_user',
> 'PORT': '',
> },
> }
>
> MEDIA_ROOT = 'C:/Users/DavidPiccione/Dropbox/Work -
> Bridge/Projects/bridge/MEDIA/'
> MEDIA_URL = '/media/'
>
> EMAIL_HOST = 'smtp.gmail.com'
> EMAIL_PORT = 587
> EMAIL_HOST_USER = 'bridgeautomaticmessen...@gmail.com'
> EMAIL_HOST_PASSWORD = 'bridgeautomaticmessenger123'
> EMAIL_USE_TLS = True
> DEFAULT_FROM_EMAIL = 'bridgeautomaticmessen...@gmail.com'
>
>
> STATIC_ROOT = ''
> STATIC_URL = '/static/'
> STATICFILES_DIRS = ("C:/Users/DavidPiccione/Dropbox/Work -
> Bridge/Projects/bridge/static",)
> STATIC_PATH = 'C:/Users/DavidPiccione/Dropbox/Work -
> Bridge/Projects/bridge/static'
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': ["C:/Users/DavidPiccione/Dropbox/Work -
> Bridge/Projects/bridge/TEMPLATES",],
> 'APP_DIRS': False,
> 'OPTIONS': {
> 'context_processors': [
> 'django.contrib.auth.context_processors.auth',
> 'django.template.context_processors.debug',
> 'django.template.context_processors.i18n',
> 'django.template.context_processors.media',
> 'django.template.context_processors.static',
> 'django.template.context_processors.tz',
> 'django.template.context_processors.request',
> 'django.contrib.messages.context_processors.messages',
> 'bridge.context_processors.global_settings',],
> },
> },
> ]
>
>
> USE_ASSOCIATION_BANK_ACCOUNTS = True
>
>
> **
>
> This is *settings_common* file
>
> DMINS = ()
> BRIDGE_VERSION = "3.6.1 Build 202004.4"
>
> MANAGERS = ADMINS
>
> TIME_ZONE = 'America/Vancouver'
> LANGUAGE_CODE = 'en-us'
> SITE_ID = 1
>
> USE_I18N = True
> USE_L10N = True
> USE_TZ = False
>
> # Make this unique and don't share it with anybody.
> SECRET_KEY ='removed for privacy reason'
> SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
>
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'bridge.request_access.Middleware',
> )
>
> ROOT_URLCONF = 'bridge.urls'
> 

Re: Possible Bug? AttributeError: 'HttpResponse' object has no attribute '_resource_closers'

2020-05-16 Thread Jorge Gimeno
On Sat, May 16, 2020 at 12:06 PM Tim Allen 
wrote:

> I posted this to Stack Overflow first, thinking it might be a problem with
> `mod_wsgi`, but people using Gunicorn have seen the issue too. Here's a
> link to the question on Stack Overflow:
>
>
> https://stackoverflow.com/questions/61295971/django-3-0-5-with-mod-wsgi-attributeerror-httpresponse-object-has-no-attribu
>
> Unfortunately, purging my cache hasn't fixed the problem like it did for a
> commenter on the question, so I'm asking here for amplification. Here's the
> text of the post:
>
> I'm getting an error when I deploy Django 3.0.5 under mod_wsgi:  
> AttributeError:
> 'HttpResponse' object has no attribute '_resource_closers'. I'm running:
>
>- Python: 3.6.8
>- Django: 3.0.5
>- Apache: 2.4.6
>- mod_wsgi: 4.6.2
>
> Here's the basics of the view causing the error; nothing too exotic (I've
> simplified the code around meetings_struct):
>
>
> class MeetingsAPIView(MeetingsBaseView):
> def get(self, request, *args, **kwargs):
> meetings = self.get_meetings()
> meetings_struct = []
>
> for meeting in meetings:
> meetings_struct.append({
> "id": meeting.id,
> "name": meeting.title,
> "slug": meeting.slug,
> })
>
> return HttpResponse(meetings_struct, content_type="application/json")
>
>
> If I activate the venv and use runserver manually on the server on port
> 80, the same view does not give an error. When the same code and venv are
> running under Apache, here's the error from Apache's logs:
>
>
> [Sat Apr 18 16:11:30.683980 2020] [wsgi:error] [pid 4154] [remote 
> 100.19.146.139:54397] mod_wsgi (pid=4154): Exception occurred processing WSGI 
> script '/var/django/sites/mysite-prod/config/wsgi.py'.[Sat Apr 18 
> 16:11:30.684834 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397] 
> Traceback (most recent call last):[Sat Apr 18 16:11:30.684891 2020] 
> [wsgi:error] [pid 4154] [remote 100.19.146.139:54397]   File 
> "/var/django/sites/mysite-prod/venv/lib64/python3.6/site-packages/django/core/handlers/wsgi.py",
>  line 133, in __call__[Sat Apr 18 16:11:30.684903 2020] [wsgi:error] [pid 
> 4154] [remote 100.19.146.139:54397] response = 
> self.get_response(request)[Sat Apr 18 16:11:30.684925 2020] [wsgi:error] [pid 
> 4154] [remote 100.19.146.139:54397]   File 
> "/var/django/sites/mysite-prod/venv/lib64/python3.6/site-packages/django/core/handlers/base.py",
>  line 76, in get_response[Sat Apr 18 16:11:30.684933 2020] [wsgi:error] [pid 
> 4154] [remote 100.19.146.139:54397] 
> response._resource_closers.append(request.close)[Sat Apr 18 16:11:30.684964 
> 2020] [wsgi:error] [pid 4154] [remote 100.19.146.139:54397] AttributeError: 
> 'HttpResponse' object has no attribute '_resource_closers'
>
>
> I've rolled back to a previous version that works, running Django 2.2; the
> rest of the stack is the same. This one has me puzzled, as using the same
> deployed code with the same venv that Apache is configured to use works
> fine under runserver, but errors with mod_wsgi. I've tried stopping and
> starting Apache, running the publish process again for a fresh venv and
> code base, and even rebooting the server. The same error occurs, but only
> under Apache / mod_wsgi.
>
>
> Any ideas? I'm puzzled!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0381e998-321e-489f-abe1-853b6997930f%40googlegroups.com
> 
> .
>

Tim,

Shot in the dark:  Did you add any middleware by chance?

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_bLzkR2TZdk-gMkzq%2BCGeUyairDupU5FAqK4wNntr2-Q%40mail.gmail.com.


Re: Issue with Heroku Getting Started

2020-05-15 Thread Jorge Gimeno
On Fri, May 15, 2020 at 5:27 PM John McClain  wrote:

> try removing this
>
> django-utils==0.0.2
>
> from requirements then run again to see next error
>

Good catch!  I'll bet there's a name collision here.

-Jorge

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


Re: Issue with Heroku Getting Started

2020-05-15 Thread Jorge Gimeno
Is this in a virtual environment? Are you using pipenv?

-Jorge

On Fri, May 15, 2020 at 1:24 PM J Maryott  wrote:

> C:\Users\jakem\python-getting-started>pip freeze
> asgiref==3.2.7
> dj-database-url==0.5.0
> Django==3.0.6
> django-heroku==0.3.1
> django-utils==0.0.2
> gunicorn==20.0.4
> psycopg2==2.8.5
> pytz==2020.1
> sqlparse==0.3.1
> whitenoise==5.0.1
>
> On Friday, May 15, 2020 at 11:29:29 AM UTC-4, jlgimeno71 wrote:
>>
>>
>>
>> On Thu, May 14, 2020 at 5:02 AM J Maryott  wrote:
>>
>>> Wondering if anyone may be able to shed some light on this...I've cloned
>>> the latest dev. version of Django from Git, and though I'm a bit of a
>>> newbie here, and this might sound totally dumb to the professionals (I'm
>>> unsure), I also tried pip install django.utilsas a last ditch
>>> effort. It seemed to download a package successfully, but still I'm
>>> receiving the same error.
>>>
>>> I've made it about halfway though the "Getting Started with Python"
>>> tutorial on the Heroku Dev Center (
>>> https://devcenter.heroku.com/articles/getting-started-with-python#run-the-app-locally),
>>> and I get the following error when attempting to run collectstatic:
>>>
>>>
>>> python manage.py collectstatic
>>>
>>> Traceback (most recent call last):
>>>   File "manage.py", line 8, in 
>>> from django.core.management import execute_from_command_line
>>>   File 
>>> "C:\Users\jakem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\__init__.py",
>>>  line 1, in 
>>> from django.utils.version import get_version
>>> ModuleNotFoundError: No module named 'django.utils'
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/1be60359-eb10-4def-90dc-762d1315e66a%40googlegroups.com
>>> 
>>> .
>>>
>>
>> Can you type pip freeze into your terminal and copy/paste the output
>> here, please?
>>
>> -Jorge
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/eda9f804-4949-4cdd-9b34-8bf7db3b049a%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK8cwA3HzqRQ6pLAS0835oK3AZ%3DHgb%2BLZqDHv9GySDwxnQ%40mail.gmail.com.


Re: Issue with Heroku Getting Started

2020-05-15 Thread Jorge Gimeno
On Thu, May 14, 2020 at 5:02 AM J Maryott  wrote:

> Wondering if anyone may be able to shed some light on this...I've cloned
> the latest dev. version of Django from Git, and though I'm a bit of a
> newbie here, and this might sound totally dumb to the professionals (I'm
> unsure), I also tried pip install django.utilsas a last ditch
> effort. It seemed to download a package successfully, but still I'm
> receiving the same error.
>
> I've made it about halfway though the "Getting Started with Python"
> tutorial on the Heroku Dev Center (
> https://devcenter.heroku.com/articles/getting-started-with-python#run-the-app-locally),
> and I get the following error when attempting to run collectstatic:
>
>
> python manage.py collectstatic
>
> Traceback (most recent call last):
>   File "manage.py", line 8, in 
> from django.core.management import execute_from_command_line
>   File 
> "C:\Users\jakem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\__init__.py",
>  line 1, in 
> from django.utils.version import get_version
> ModuleNotFoundError: No module named 'django.utils'
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1be60359-eb10-4def-90dc-762d1315e66a%40googlegroups.com
> 
> .
>

Can you type pip freeze into your terminal and copy/paste the output here,
please?

-Jorge

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


Re: ModuleNotFoundError:

2020-05-08 Thread Jorge Gimeno
On Fri, May 8, 2020 at 5:12 PM nor sairi  wrote:

> AttributeError: module 'django.contrib' has no attribute 'gisproperty'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File
> "/home/sairi/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py",
> line 225, in wrapper
> fn(*args, **kwargs)
>   File
> "/home/sairi/anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py",
> line 109, in inner_run
> autoreload.raise_last_exception()
>   File
> "/home/sairi/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py",
> line 248, in raise_last_exception
> raise _exception[1]
>   File
> "/home/sairi/anaconda3/lib/python3.7/site-packages/django/core/management/__init__.py",
> line 337, in execute
> autoreload.check_errors(django.setup)()
>   File
> "/home/sairi/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py",
> line 225, in wrapper
> fn(*args, **kwargs)
>   File
> "/home/sairi/anaconda3/lib/python3.7/site-packages/django/__init__.py",
> line 24, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File
> "/home/sairi/anaconda3/lib/python3.7/site-packages/django/apps/registry.py",
> line 89, in populate
> app_config = AppConfig.create(entry)
>   File
> "/home/sairi/anaconda3/lib/python3.7/site-packages/django/apps/config.py",
> line 123, in create
> import_module(entry)
>   File "/home/sairi/anaconda3/lib/python3.7/importlib/__init__.py", line
> 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1006, in _gcd_import
>   File "", line 983, in _find_and_load
>   File "", line 965, in
> _find_and_load_unlocked
> ModuleNotFoundError: No module named 'django.contrib.gisproperty'
>
> Hello guys , what this meaning ..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3e8a7709-985a-4fdf-8209-f9d3fe4c9809%40googlegroups.com
> 
> .
>

It means there is nothing named gisproperty at django.contrib.  If you want
an intro to GIS in Django, see here:
https://docs.djangoproject.com/en/3.0/ref/contrib/gis/tutorial/

-Jorge

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


Re: django.core.exceptions.ImproperlyConfigured: error is coming

2020-05-08 Thread Jorge Gimeno
On Fri, May 8, 2020 at 2:00 AM ratnadeep ray  wrote:

> I am new to Django and hence don't have much idea about it. I am trying to
> create an app having the following contents in my view.py file:
>
> from django.shortcuts import render
>> from fusioncharts.models import City
>> def pie_chart(request):
>> labels = []
>> data = []
>> queryset = City.objects.order_by('-population')[:3]
>> for city in queryset:
>> labels.append(city.name)
>> data.append(city.population)
>> return render(request, 'pie_chart.html', {
>> 'labels': labels,
>> 'data': data,
>> })
>
>
> The content of my urls.py file inside the app is as follows:
>
> from django.urls import path
>> from fusioncharts import views
>> urlpatterns = [
>> path('pie-chart/', views.pie_chart, name='pie-chart'),
>> ]
>
>
> and the content of my urls.py file inside the main project folder is as
> follows:
>
> from django.contrib import admin
>> from django.urls import path
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', include('fusioncharts.urls'))
>> ]
>
>
> In the settings.py file, I have added the following:
>
> ROOT_URLCONF = 'Piechart.urls'
>
>
> and under the TEMPLATES, added the following:
>
> 'DIRS': ['Piechart/fusioncharts/templates'],
>
>
> Now while running my app, I am getting the following error:
>
> *django.core.exceptions.ImproperlyConfigured: The included URLconf
>> 'Piechart.urls' does not appear to have any patterns in it. If you see
>> valid patterns in the file then the issue is probably caused by a circular
>> import.*
>
>
> Can anyone please say what's going wrong?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8afd3990-d71b-4783-a478-0b18bf05389f%40googlegroups.com
> 
> .
>

ROOT_URLCONF is meant to tell Django where the root urls.py is.  It is
generated by manage.py startproject to point to the urls.py it creates in
settings.py.  In your case, it should point to '.urls', where
 is your main project folder.

Then, I would use an include in the root urls.py to add the pie-chart
route, similar to what you did for fusioncharts.

-Jore

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK8ca%3DNPXowoODi%2B35zgCA2DxgwhWcvMCT6XxLM-axo%2B8g%40mail.gmail.com.


Re: Django Media Static Files

2020-05-06 Thread Jorge Gimeno
On Wed, May 6, 2020 at 3:09 AM ilda.pedro1993 
wrote:

> Hello, everyone!
> My name is Ilda, i'm getting a page not found when trying to load django
> media files.
>
> My django settings file looks like below:
>
> [image: Captura de Tela (148).png]
>
>
>
>
>
>
>
> And saw many suggestions to concatenate my app urls with the static one
> like:
>
> urlpatterns +=static(setting.MEDIA_URL, document_root=MEDIA_ROOT)
>
> But after storing the media files when i try to load a get always a not
> found page.
>
> Im using Django 3.0.2
>
> Can anybody help me out there?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c08b99df-9423-46b6-8edf-34f01f550bc7%40googlegroups.com
> 
> .
>

Are you getting a 404 in production, or while using the development server
(manage.py runserver)?

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK8F%2BR1JmugS1jj9wzQ6C%2BkdjfcL6OL75sU_6pzz-2cesQ%40mail.gmail.com.


Re: How to customize the authentication system?

2020-05-06 Thread Jorge Gimeno
On Wed, May 6, 2020, 3:08 AM Camilo Garcia 
wrote:

> I want to use the authentication system that django comes with, but the
> default model doesn't work for me, so I have to implement my own user
> model, the truth is that I don't know how I could do it without losing the
> power that this system offers me.
>
> Any step-by-step guide you recommend? I'm a newbie, so far I'm learning
> how to use the framework.
>
> I thank you in advance and hope you can help me.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f40de223-b53c-4a14-89dd-ec8bd65b2880%40googlegroups.com
> 
> .
>

There's a tutorial here:
https://wsvincent.com/django-custom-user-model-tutorial/

-Jorge

>

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


Re: Best hosting for Django Application?

2020-05-05 Thread Jorge Gimeno
On Tue, May 5, 2020 at 10:36 AM JEGATHEESWARAN SUNDARAVADIVEL <
jagatheesjo...@gmail.com> wrote:

> You can check pythonanywhere hosting
>
> Thanks and regards
> Jegatheeswaran
>
> On Tue, 5 May 2020 at 23:03, Sherif Adigun  wrote:
>
>> I am planning to launch my first major Django application on a live
>> server for production. Could you please suggest hosting service that is
>> reliable and considerably cheap?
>>
>> I have used Heroku but not for a serious or client project.
>>
>> Please tell me your experience and advise.
>>
>> Thank you
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4ab11f17-77cd-4772-ab78-fc4619bb3978%40googlegroups.com
>> 
>> .
>>
> --
> JAGATHEESWARAN
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHM%2BSVp42y2_rzWVpgU4TxSE71%3DPc8WaV2uKNDjhtK4XvXV9%2Bg%40mail.gmail.com
> 
> .
>

There's good options out there.  As with everything, there's a tradeoff to
consider.

1.  How much work do I want to put into DevOps?

2.  How much am I willing to pay to have someone else do it?

If you're willing to do the work yourself, then a self-hosted option would
be best.  DigitalOcean and Linode are two services I have used in the
past.  For enterprise level stuff, Amazon Web Services is the option I hear
most (I don't have anything with needs at this level).

If you want to pass the hard work to someone else, then a Platform as a
Service may be the way to go.  Heroku you've mentioned, PythonAnywhere has
been suggested, Divio is a new one I have heard about.

Hope this helps!

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK8%2BhFRCY3JfXBDGm-TNU5Sc-fDn%3DvsLjP9y3s8QMNFsXA%40mail.gmail.com.


Re: Page 404 error after running Django server

2020-05-04 Thread Jorge Gimeno
I just realized that the view is returning an HttpRequest.  It should be an
HttpResponse object (and the import should be changed to bring that object
in as well).

-Jorge

On Mon, May 4, 2020 at 11:43 AM Deepti sharma 
wrote:

> @rdsaini...@gmail.com
> I updated it with: path("welcome/",views.welcome),
> But  no success.
>
> Error at http://127.0.0.1:8000/welcome :
>
> TypeError at /welcome/
>
> __init__() takes 1 positional argument but 2 were given
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/welcome/
> Django Version: 3.0.5
> Exception Type: TypeError
> Exception Value:
>
> __init__() takes 1 positional argument but 2 were given
>
> Exception Location: 
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\meeting_planner\website\views.py
> in welcome, line 6
> Python Executable:
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\Scripts\python.exe
> Python Version: 3.7.7
> Python Path:
>
> ['C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\meeting_planner',
>  
> 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
>  'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
>  'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\lib',
>  'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37',
>  'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv',
>  
> 'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv\\lib\\site-packages']
>
> Server time: Mon, 4 May 2020 18:40:54 +
> Traceback Switch to copy-and-paste view 
>
>-
>
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\exception.py
> in inner
>1.
>
>   response = get_response(request)
>
>   …
>▶ Local vars 
>-
>
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
> in _get_response
>1.
>
>   response = self.process_exception_by_middleware(e, 
> request)
>
>   …
>▶ Local vars 
>-
>
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
> in _get_response
>1.
>
>   response = wrapped_callback(request, *callback_args, 
> **callback_kwargs)
>
>
>
>
>
> On Mon, May 4, 2020 at 2:37 PM R D Saini  wrote:
>
>> path("welcome/",views.welcom),
>>
>> On Mon 4 May, 2020, 11:42 PM 'Amitesh Sahay' via Django users, <
>> django-users@googlegroups.com> wrote:
>>
>>> There are lots of issues with urls.py
>>> Please go through the django documents on how to write urls.py
>>>
>>> Sent from Yahoo Mail on Android
>>> 
>>>
>>> On Mon, 4 May 2020 at 23:39, Deepti sharma
>>>  wrote:
>>> Hi, I have just started learning django and was trying to make a meeting
>>> planner project y folllowing a course.
>>> I updated the setting.py file to add website into Instaled_Apps. Then
>>> have written a function named welcome in views.py
>>> Finally I added it's entry into urls.py fie
>>> But when I run the server, I am getting following error on webpage:
>>>
>>> Page not found (404)
>>> Request Method: GET
>>> Request URL: http://127.0.0.1:8000/
>>>
>>> Using the URLconf defined in meeting_planner.urls, Django tried these
>>> URL patterns, in this order:
>>>
>>>1. admin/
>>>2. welcome.html/
>>>
>>> The empty path didn't match any of these.
>>>
>>> You're seeing this error because you have DEBUG = True in your Django
>>> settings file. Change that to False, and Django will display a standard
>>> 404 page.
>>>
>>>
>>> Can someone please help me with this? I am stuck.
>>>
>>>
>>>
>>> This is my code:  (meeting_planner/website/views.py):
>>>
>>> from django.shortcuts import render
>>> from django.http import HttpRequest
>>> # Create your views here.
>>>
>>> def welcome(request):
>>> return HttpRequest("Welcome to the Meeting Planner Website!")
>>>
>>>
>>> (meeting_planner/meeting_planer/urls.py):
>>>
>>> from django.contrib import admin
>>> from django.urls import path
>>> from website import views
>>> from django.conf.urls import url,include
>>>
>>> from website.views import welcome
>>>
>>> urlpatterns = [
>>> path('admin/', admin.site.urls),
>>> path('welcome.html', welcome)
>>> ]
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%40googlegroups.com
>>> 

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-03 Thread Jorge Gimeno
On Sun, May 3, 2020 at 1:04 PM Iain Stewart 
wrote:

> Hi Famzaa,
>
> I have made migrations but the admin interface is not finding the database
> perhaps? I get this exception:
>
> Exception Location: 
> C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py
> in execute, line 296
>
> Any help much appreciated.
>
> Iain
>
> On Sunday, 3 May 2020 00:06:57 UTC+1, Famzaa wrote:
>>
>> first run makemigrations and then migrate to create table if you see the
>> model name in  admin section this means that the table is created sometimes
>> this happens when you make changes to the model and don't run migrations.
>>
>> On Sat, May 2, 2020 at 10:33 PM Jorge Gimeno  wrote:
>>
>>>
>>>
>>> On Sat, May 2, 2020 at 7:43 AM Iain Stewart  wrote:
>>>
>>>> Hi Folks,
>>>>
>>>> I am a learner and am enjoying learning Django so far (about a month
>>>> in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
>>>> trying to save my first product on the Django admin/ products page and got
>>>> the following error. I suspect the problem is between Django and SQLite.
>>>> Any possible solution would be appreciated. Thanks!
>>>> Request Method: POST Request URL: 
>>>> http://127.0.0.1:8000/admin/products/product/add/
>>>>
>>>> <https://www.youtube.com/redirect?q=http%3A%2F%2F127.0.0.1%3A8000%2Fadmin%2Fproducts%2Fproduct%2Fadd%2F_token=ri7g7iQXEDVzCKUpVygfGVRdSNh8MTU4ODQ5ODI0OEAxNTg4NDExODQ4=comments=Ugzjv_AAC_iJQGZgxuB4AaABAg>
>>>>  Django
>>>> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
>>>> ['django.contrib.admin',
>>>> 'django.contrib.auth', 'django.contrib.contenttypes', 
>>>> 'django.contrib.sessions',
>>>> 'django.contrib.messages', 'django.contrib.staticfiles', 
>>>> 'products.apps.ProductsConfig']
>>>> Installed Middleware: ['django.middleware.security.SecurityMiddleware',
>>>> 'django.contrib.sessions.middleware.SessionMiddleware', 
>>>> 'django.middleware.common.CommonMiddleware',
>>>> 'django.middleware.csrf.CsrfViewMiddleware', 
>>>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>>>> 'django.contrib.messages.middleware.MessageMiddleware', 
>>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware']
>>>> Traceback: File
>>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
>>>> utils.py
>>>> <https://www.youtube.com/redirect?q=http%3A%2F%2Futils.py%2F_token=ri7g7iQXEDVzCKUpVygfGVRdSNh8MTU4ODQ5ODI0OEAxNTg4NDExODQ4=comments=Ugzjv_AAC_iJQGZgxuB4AaABAg>"
>>>> in _execute 85. return self.cursor.execute(sql, params) File
>>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
>>>> base.py
>>>> <https://www.youtube.com/redirect?q=http%3A%2F%2Fbase.py%2F_token=ri7g7iQXEDVzCKUpVygfGVRdSNh8MTU4ODQ5ODI0OEAxNTg4NDExODQ4=comments=Ugzjv_AAC_iJQGZgxuB4AaABAg>"
>>>> in execute 296. return Database.Cursor.execute(self, query, params) The
>>>> above exception (no such table: main.auth_user__old) was the direct cause
>>>> of the following exception: File
>>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>>> exception.py
>>>> <https://www.youtube.com/redirect?q=http%3A%2F%2Fexception.py%2F_token=ri7g7iQXEDVzCKUpVygfGVRdSNh8MTU4ODQ5ODI0OEAxNTg4NDExODQ4=comments=Ugzjv_AAC_iJQGZgxuB4AaABAg>"
>>>> in inner 34. response = get_response(request) File
>>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>>> base.py
>>>> <https://www.youtube.com/redirect?q=http%3A%2F%2Fbase.py%2F_token=ri7g7iQXEDVzCKUpVygfGVRdSNh8MTU4ODQ5ODI0OEAxNTg4NDExODQ4=comments=Ugzjv_AAC_iJQGZgxuB4AaABAg>"
>>>> in _get_response 126. response =
>>>> self.process_exception_by_middleware(e, request) File
>>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>>> base.py
>>>> <https://www.youtube.com/redirect?q=http%3A%2F%2Fbase.py%2F_token=ri7g7iQXEDVzCKUpVygfGVRdSNh8MTU4ODQ5ODI0OEAxNTg4NDExODQ4=comments=Ugzjv_AAC_iJQGZgxuB4AaABAg>"
>>>> in _get_response 124. response = wrapped_callback(request,
>>>> *callback_args, **callback_kwargs) File
>>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-package

Re: Form not visible on the add page

2020-05-03 Thread Jorge Gimeno
On Sun, May 3, 2020 at 7:34 AM Vikram Jaiswal <
vikramkumarjaiswal221...@gmail.com> wrote:

> I am not able to see the form on admin page to add the data
> First
>   -First
>  -settings.py
>  -urls.py
>   -travello
>  -migrations
>  -urls.py
>  -models.py
>  -admin.py
>
> here is the models.py
> from django.db import models
>
> # Create your models here.
> class Destination(models.Model):
> #id : int
> name : models.CharField(max_length=100)#str
> img : models.ImageField(upload_to='pics')#str
> desc : models.CharField(max_length=100)#str
> price : models.IntegerField()#int
> offer : models.BooleanField(default=False)#bool
>
>
> here is the admin.py
> from django.contrib import admin
> from travello.models import Destination
>
>
>
>
> # Register your models here.
> admin.site.register(Destination)
>
> Please 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6f1d4cad-2d83-454d-b49b-7eaaef5b0ea8%40googlegroups.com
> 
> .
>

This is related to your previous post.  The fields aren't showing up, and
they won't until they are properly defined and the database migration is
done.

-Jorge

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


Re: Form is not getting displayed on django admin page

2020-05-03 Thread Jorge Gimeno
On Sun, May 3, 2020 at 7:34 AM Vikram Jaiswal <
vikramkumarjaiswal221...@gmail.com> wrote:

> above is the image of the error
> admin.py
> from django.contrib import admin
> from travello.models import Destination
>
>
>
> class ContactAdmin(admin.ModelAdmin):
> Clist_display = [ 'name', 'department', 'lalal']
> # Register your models here.
> admin.site.register(Destination,ContactAdmin)
>
>
> models.py
> from django.db import models
>
> # Create your models here.
> class Destination(models.Model):
> #id : int
> name : models.CharField(max_length=100)#str
> img : models.ImageField(upload_to='pics')#str
> desc : models.CharField(max_length=100)#str
> price : models.IntegerField()#int
> offer : models.BooleanField(default=False)#bool
>
>
> When i try to use
> python manage.py makemigrations
> then in 0001_inital.py only contains id attribute.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f60acf9d-d64d-4792-a9c1-5585d40758e6%40googlegroups.com
> 
> .
>

To create the fields in Python models, we have to set the name of the
attributes equal to the class of the field type.  In simpler terms, using
your model class and just the name attribute:

from django.db import models


class Destination(models.Model):
name = models.CharField(max_length=100)

Try setting the rest of the attributes using the assignment operator ('='),
then run migrations again.  You should see the fields in the admin.

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK85E13zVaOHuJA%2BMegWXq%2BSx%2BY8%2B7ymoUW4-9F-msikmw%40mail.gmail.com.


Re: OperationalError at /admin/login/attempt to write a readonly database

2020-05-03 Thread Jorge Gimeno
On Sun, May 3, 2020 at 3:46 AM Amina Anna Mahamane.O 
wrote:

> I read , but I didn’t help me , I don’t really know hiw to process . Can
> you explain me ?
>

I'm not a linux expert, so other folks can feel free to correct me.

In linux, the user that creates the file in a directory they have access to
has "ownership" of the file.  With that, the user can both read and write
to the file.  All other users (except for sudo users, I believe) have
read-only access by default.

That's what's happening here.  When you ran migrations as the currently
logged in user, your user has read and write permissions.  Apache, however,
runs as a different user, so it cannot write to the database.

That answer I linked did have some things to try, in addition to a link to
more general question about permissions.  The file you would need to change
permissioins on (since you're using sqlite3, which is file based) is named
(without quotes) "db.sqlite3'.

Hope this helps!

-Jorge

>
> Envoyé de mon iPhone
>
> Le 3 mai 2020 à 05:21, Jorge Gimeno  a écrit :
>
> 
>
>
> On Sat, May 2, 2020 at 8:09 PM Amina Anna Mahamane.O 
> wrote:
>
>> Hello , I started learning how to use django . I made a project without a
>> virtual environnement and without apach2 andn mod wsgi .
>> Now am I trying to do a project with those ones . I am a beginner .When
>> I try to log in to the administration interface, the error below appears.I've
>> been looking for solutions on the internet for hours and hours but I didn't
>> find anything which can help me to solve my problem. I have no idea what
>> could have caused this error.I really need help, it's urgent. I wish
>> someone can answer to me in french but if it is not possible, help me
>> anyway, I will manage.
>>
>> OperationalError at /admin/login/
>>
>> attempt to write a readonly database
>>
>> Request Method: POST
>> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
>> Django Version: 3.0.5
>> Exception Type: OperationalError
>> Exception Value:
>>
>> attempt to write a readonly database
>>
>> Exception Location: 
>> /home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py
>> in execute, line 396
>> Python Executable: /home/kirikou/mysite/env/bin/python
>> Python Version: 3.7.5
>> Python Path:
>>
>> ['/home/kirikou/mysite',
>>  '/usr/lib/python37.zip',
>>  '/usr/lib/python3.7',
>>  '/usr/lib/python3.7/lib-dynload',
>>  '/home/kirikou/mysite/env/lib/python3.7/site-packages']
>>
>> Server time: Sat, 2 May 2020 21:39:20 +
>>
>>
>>
>> Environment:
>>
>>
>> Request Method: POST
>> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
>>
>> Django Version: 3.0.5
>> Python Version: 3.7.5
>> Installed Applications:
>> ['applis.apps.ApplisConfig',
>>  'django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'django.contrib.admindocs']
>> Installed Middleware:
>> ['django.middleware.security.SecurityMiddleware',
>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware']
>>
>>
>>
>> Traceback (most recent call last):
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py",
>> line 86, in _execute
>> return self.cursor.execute(sql, params)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py",
>> line 396, in execute
>> return Database.Cursor.execute(self, query, params)
>>
>> The above exception (attempt to write a readonly database) was the direct
>> cause of the following exception:
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/exception.py",
>> line 34, in inner
>> response = get_response(request)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
>> line 115, in _get_response
>> response = self.process_exception_by_middleware(e, request)
>>   File
>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/dj

Re: OperationalError at /admin/login/attempt to write a readonly database

2020-05-02 Thread Jorge Gimeno
On Sat, May 2, 2020 at 8:09 PM Amina Anna Mahamane.O 
wrote:

> Hello , I started learning how to use django . I made a project without a
> virtual environnement and without apach2 andn mod wsgi .
> Now am I trying to do a project with those ones . I am a beginner .When I
> try to log in to the administration interface, the error below appears.I've
> been looking for solutions on the internet for hours and hours but I didn't
> find anything which can help me to solve my problem. I have no idea what
> could have caused this error.I really need help, it's urgent. I wish
> someone can answer to me in french but if it is not possible, help me
> anyway, I will manage.
>
> OperationalError at /admin/login/
>
> attempt to write a readonly database
>
> Request Method: POST
> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
> Django Version: 3.0.5
> Exception Type: OperationalError
> Exception Value:
>
> attempt to write a readonly database
>
> Exception Location: 
> /home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py
> in execute, line 396
> Python Executable: /home/kirikou/mysite/env/bin/python
> Python Version: 3.7.5
> Python Path:
>
> ['/home/kirikou/mysite',
>  '/usr/lib/python37.zip',
>  '/usr/lib/python3.7',
>  '/usr/lib/python3.7/lib-dynload',
>  '/home/kirikou/mysite/env/lib/python3.7/site-packages']
>
> Server time: Sat, 2 May 2020 21:39:20 +
>
>
>
> Environment:
>
>
> Request Method: POST
> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/
>
> Django Version: 3.0.5
> Python Version: 3.7.5
> Installed Applications:
> ['applis.apps.ApplisConfig',
>  'django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'django.contrib.admindocs']
> Installed Middleware:
> ['django.middleware.security.SecurityMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware']
>
>
>
> Traceback (most recent call last):
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py",
> line 86, in _execute
> return self.cursor.execute(sql, params)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py",
> line 396, in execute
> return Database.Cursor.execute(self, query, params)
>
> The above exception (attempt to write a readonly database) was the direct
> cause of the following exception:
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/exception.py",
> line 34, in inner
> response = get_response(request)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
> line 115, in _get_response
> response = self.process_exception_by_middleware(e, request)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py",
> line 113, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/cache.py",
> line 44, in _wrapped_view_func
> response = view_func(request, *args, **kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/admin/sites.py",
> line 407, in login
> return LoginView.as_view(**defaults)(request)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/generic/base.py",
> line 71, in view
> return self.dispatch(request, *args, **kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py",
> line 43, in _wrapper
> return bound_method(*args, **kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/debug.py",
> line 76, in sensitive_post_parameters_wrapper
> return view(request, *args, **kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py",
> line 43, in _wrapper
> return bound_method(*args, **kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py",
> line 130, in _wrapped_view
> response = view_func(request, *args, **kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py",
> line 43, in _wrapper
> return bound_method(*args, **kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/cache.py",
> line 44, in _wrapped_view_func
> response = view_func(request, *args, **kwargs)
>   File
> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/auth/views.py",

Re: Making Serial number

2020-05-02 Thread Jorge Gimeno
On Sat, May 2, 2020 at 10:37 AM Kushal Neupane  wrote:

> Not primary key to use here.
> There might be different data.
> I am trying to do serial numbers as total numbers in the list. Thank you
>
> On Sat, May 2, 2020, 23:20 Jorge Gimeno  wrote:
>
>>
>>
>> On Sat, May 2, 2020 at 9:03 AM Kushal Neupane 
>> wrote:
>>
>>> How to make Serail Number 1, 2, 3 and respective in template? Help me.
>>> Thank you.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/3842baeb-b054-482a-b127-ae5c160493ca%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/3842baeb-b054-482a-b127-ae5c160493ca%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>
>> Models in Python have an autoincrementing primary key (unless you have
>> turned that off).  See
>> https://docs.djangoproject.com/en/3.0/topics/db/models/#automatic-primary-key-fields
>>
>> -Jorge
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANfN%3DK-HEni_1DQL7CKrE3nWtu%2BR1WgKmaAoMpPjiDsUd%3Daq6w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANfN%3DK-HEni_1DQL7CKrE3nWtu%2BR1WgKmaAoMpPjiDsUd%3Daq6w%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFWyajUO4aw9qdb-zx1j_DYbFMDS2WrTzs8zVd0_tB3xYjNNaw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFWyajUO4aw9qdb-zx1j_DYbFMDS2WrTzs8zVd0_tB3xYjNNaw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

If you're looking to use the template to generate line numbers, I would
start with the linenumbers template tag:
https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#linenumbers

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-pV4zjDzbYGzVx97K3Xr%2BGwMJGn%2B4Zfc-kb4tK7zE0iw%40mail.gmail.com.


Re: Making Serial number

2020-05-02 Thread Jorge Gimeno
On Sat, May 2, 2020 at 9:03 AM Kushal Neupane  wrote:

> How to make Serail Number 1, 2, 3 and respective in template? Help me.
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3842baeb-b054-482a-b127-ae5c160493ca%40googlegroups.com
> 
> .
>

Models in Python have an autoincrementing primary key (unless you have
turned that off).  See
https://docs.djangoproject.com/en/3.0/topics/db/models/#automatic-primary-key-fields

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-HEni_1DQL7CKrE3nWtu%2BR1WgKmaAoMpPjiDsUd%3Daq6w%40mail.gmail.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-02 Thread Jorge Gimeno
On Sat, May 2, 2020 at 7:43 AM Iain Stewart 
wrote:

> Hi Folks,
>
> I am a learner and am enjoying learning Django so far (about a month in).
> I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
> trying to save my first product on the Django admin/ products page and got
> the following error. I suspect the problem is between Django and SQLite.
> Any possible solution would be appreciated. Thanks!
> Request Method: POST Request URL: 
> http://127.0.0.1:8000/admin/products/product/add/
>
> 
>  Django
> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
> ['django.contrib.admin',
> 'django.contrib.auth', 'django.contrib.contenttypes', 
> 'django.contrib.sessions',
> 'django.contrib.messages', 'django.contrib.staticfiles', 
> 'products.apps.ProductsConfig']
> Installed Middleware: ['django.middleware.security.SecurityMiddleware', 
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware', 
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
> utils.py
> "
> in _execute 85. return self.cursor.execute(sql, params) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
> base.py
> "
> in execute 296. return Database.Cursor.execute(self, query, params) The
> above exception (no such table: main.auth_user__old) was the direct cause
> of the following exception: File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
> exception.py
> "
> in inner 34. response = get_response(request) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
> base.py
> "
> in _get_response 126. response = self.process_exception_by_middleware(e,
> request) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
> base.py
> "
> in _get_response 124. response = wrapped_callback(request,
> *callback_args, **callback_kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
> options.py
> "
> in wrapper 607. return self.admin_site.admin_view(view)(*args, **kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
> decorators.py
> "
> in _wrapped_view 142. response = view_func(request, *args, **kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\
> cache.py
> "
> in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
> sites.py
> "
> in inner 223. return view(request, *args, **kwargs) File
> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
> options.py
> "
> in add_view 1647. return self.changeform_view(request, None, form_url,
> extra_context) File
> 

Re: I really need help pls assist this error

2020-04-30 Thread Jorge Gimeno
On Thu, Apr 30, 2020, 5:05 AM Listenable Music  wrote:

> 1st error in http://127.0.0.1:8000/ i dont know why I don't see any error
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
>
> Using the URLconf defined in wisdompets.urls, Django tried these URL
> patterns, in this order:
>
>1. admin/
>2. ^$ [name='home']
>3. ^adoptions/(\d+)/ [name='pet_detail']
>
> The empty path didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
>
>
> 2nd Error filename views.py
> from django.contrib import admin
> from django.urls import path
> from adoptions import views
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path(r'^$', views.home, name='home'),
> path(r'^adoptions/(\d+)/', views.pet_detail, name='pet_detail'),
> ]
>
>
>
>
> 3rd error filename
>
>
> from django.contrib import admin
> from django.urls import path
> from adoptions import views
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path(r'^$', views.home, name='home'),
> path(r'^adoptions/(\d+)/', views.pet_detail, name='pet_detail'),
> ]
>
>
>
> 4th error in terminal
>
>
> WARNINGS:
>
> ?: (2_0.W001) Your URL pattern '^$' [name='home'] has a route that
> contains '(?P<', begins with a '^', or ends with a '$'. This was likely an
> oversight when migrating to django.urls.path().
>
> ?: (2_0.W001) Your URL pattern '^adoptions/(\d+)/' [name='pet_detail'] has
> a route that contains '(?P<', begins with a '^', or ends with a '$'. This
> was likely an oversight when migrating to django.urls.path().
>
>
> System check identified 2 issues (0 silenced).
>
> April 30, 2020 - 09:22:25
>
> Django version 3.0.5, using settings 'wisdompets.settings'
>
> Starting development server at http://127.0.0.1:8000/
>
> Quit the server with CONTROL-C.
>
> Not Found: /
>
> [30/Apr/2020 09:22:29] "GET / HTTP/1.1" 404 2176
>
> Not Found: /
>
> [30/Apr/2020 09:22:53] "GET / HTTP/1.1" 404 2176
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b28044c2-c7f6-4cd8-a5e1-a20d9d8abfd1%40googlegroups.com
> 
> .
>

In Django 2.0+, path objects were introduced.  They do not use eegular
expressions like url objects did.  They use strings.  You can see examples
in the docs here:

https://docs.djangoproject.com/en/3.0/topics/http/urls/

If you want to use regular expressions still, I believe they are re-path
objects.  See the link above.

Hope this helps!

-Jorge

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


Re: The database backend does not accept 0 as a value for AutoField.

2020-04-26 Thread Jorge Gimeno
On Sun, Apr 26, 2020 at 9:53 AM Antje Kazimiers  wrote:

> how about adding null=True and blank=True to the field?
> On 4/26/20 6:38 PM, Mayur Bagul wrote:
>
> Hey thanks for your response i did so because initially at the time of
> migration it was asking for default value and i just putted false in rush.
> that filed user from User model returns username as string autofield so
> what shall i put as default their?
> i tried to put None for default value but while migrating it giving same
> error :--
>
>  line 192, in validate_autopk_value
> raise ValueError('The database backend does not accept 0 as a '
> ValueError: The database backend does not accept 0 as a value for
> AutoField.
>
> guys help me with this error .
>
>
> On Sunday, April 26, 2020 at 9:10:41 PM UTC+5:30, Antje Kazimiers wrote:
>>
>> setting default=False is odd for any field other than a BooleanField. I
>> would take that out for the OneToOneField at least and see how things go.
>>
>> Antje
>> On 4/26/20 4:19 PM, Mayur Bagul wrote:
>>
>> Hello guys,
>>
>> im stucked with this error mentioned in subject.
>> below link redirect details about question.
>>
>> https://stackoverflow.com/q/61427882/11351226
>>
>> let me know how to get rid of this problem.
>>
>>
>> Thanking You.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/cad442bf-e697-47c6-a0b4-3ce65bcef480%40googlegroups.com
>> 
>> .
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7c34122c-0260-4a5b-8586-42c0037f8192%40googlegroups.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5dd77724-3b33-ee13-41b0-19bbcc927fd0%40gmail.com
> 
> .
>

I would remove all the default=False options from your model fields in
Owner. Re-run migrations, and try to submit the form again.

-Jorge

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


Re: Deploying Django Project on heroku

2020-04-25 Thread Jorge Gimeno
On Sat, Apr 25, 2020 at 7:13 AM Sunday Iyanu Ajayi 
wrote:

> I have spent over 2weeks on deploying a django project to heroku but I
> keep getting error messages such as :
>
> My WhiteNoise is not configured  and I have followed all the tutorials
> recommended  and yet same thing.
>
> Please who has a guide I can follow that is very updated.
> Thank you.
> *AJAYI Sunday *
> (+234) 806 771 5394
> *sunnexaj...@gmail.com *
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKYSAw2PsC452Sk5_1e_sMy3HuZ3zWrFh5p6CVn6K-KsVF1Rqg%40mail.gmail.com
> 
> .
>

This is one that's current and I have used before:
https://github.com/jlgimeno/wagtail-heroku-deployment

-Jorge

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


Re: Problem with user.username

2020-04-23 Thread Jorge Gimeno
On Thu, Apr 23, 2020, 8:59 AM Bishop Akolgo  wrote:

> i have a similar problem.  when i installed the env and django it did not
> require me to create password but after successfully installing django and
> trying to open admin, i need password and i cannot enter so i am stuck.
> Can someone help me?
>
>
> On Tuesday, July 12, 2011 at 7:31:27 AM UTC+1, Suprnaturall wrote:
>>
>> Hi,
>>
>> First of all, apologize me for my poor, poor english.
>>
>> I m new with django and i m stuck with a odd thing.
>>
>> I created a login form and use the default django login handlet like
>> this :
>>
>> base.html :
>> (...){% if user.is_authenticated %}
>> {{user.username }}
>> {% else %}
>> Login
>> {% endif %}
>> log out> (...)
>> login.html :
>> {% extends "base.html" %}
>>
>> {% block content %}
>>
>> {% if form.errors %}
>> Your username and password didn't match. Please try again.
>> {% endif %}
>>
>> 
>> {% csrf_token %}
>> 
>> 
>> {{ form.username.label_tag }}
>> {{ form.username }}
>> 
>> 
>> {{ form.password.label_tag }}
>> {{ form.password }}
>> 
>> 
>>
>> 
>> 
>> 
>> {% endblock %}
>>
>>
>> The problem is : when i m in login.html i see my user.username, but
>> when i submit the login form and being redirect to index i don t
>> retrieve the user.username.
>> I add in my views.py this import :
>> from django.template import Context, loader, RequestContext
>> from empireFront.models import Video
>> from django.http import HttpResponse
>> from django.contrib import auth
>> from django.contrib.auth import authenticate, login, logout
>> from django.contrib.auth.models import User
>> from django.http import HttpResponseRedirect
>> from django.contrib.sessions.models import Session
>>
>> I heard something about use render_to_response but when, where and
>> how ?
>>
>> Thx for your 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7f4f7a9f-cf9a-4bf1-9d63-d2b711a58f68%40googlegroups.com
> 
> .
>

Did you create an administrative user?  In Django, it's python manage.py
createsuperuser

-Jorge

>

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


Re: django.urls.exceptions.NoReverseMatch: 'courses' is not a registered namespace

2020-04-23 Thread Jorge Gimeno
On Thu, Apr 23, 2020, 7:46 AM Bruno Gama  wrote:

> I have a problem since I tried to use get_absolute_url(self): to enter in
> a url beyond a photo. When I used , my index.html stopped running.
>
> Here I have the top level url.py
>
> from  import adminfrom django.urls import path, includefrom simplemooc.core 
> import views, urlsfrom simplemooc.courses import views, urlsfrom django.conf 
> import settingsfrom django.conf.urls.static import static
>
>
> urlpatterns = [path('admin/', admin.site.urls),
>path('', include(('simplemooc.core.urls', 'simplemooc'), 
> namespace='core')),
>path('cursos', include(('simplemooc.courses.urls', 
> 'simplemooc'), namespace='courses'))]
> if settings.DEBUG:
> urlpatterns += static(settings.MEDIA_URL, 
> document_root=settings.MEDIA_ROOT)
>
> Here courses/url.py
>
> from django.urls import pathfrom simplemooc.courses import views
>
> urlpatterns = [path('', views.index, name='index'),
>path('//', views.details, name='datails')]
>
> Here courses/model.py
>
> from django.db import modelsfrom django.urls import reverse
>
> class CourseManager(models.Manager):
>
> def search(self, query):
> return self.get_queryset().filter(
> models.Q(name__icontains=query) | \
> models.Q(description__icontains=query)
> )
>
> class Course(models.Model):
>
> name = models.CharField('Nome', max_length=100)
> slug = models.SlugField('Atalho')
> description = models.TextField('Descrição Simples', blank=True)
> about = models.TextField('Sobre o Curso', blank=True)
> start_date = models.DateField(
> 'Data de Início', null=True, blank=True
> )
> image = models.ImageField(
> upload_to='courses/images', verbose_name='Imagem',
> null=True, blank=True
> )
>
> created_at = models.DateTimeField(
> 'Criado em', auto_now_add=True
> )
> updated_at = models.DateTimeField('Atualizado em', auto_now=True)
>
> objects = CourseManager()
>
> def __str__(self):
> return self.name
>
> def get_absolute_url(self):
> return reverse('courses:datails', (), {'slug': self.slug})
>
> class Meta:
> verbose_name = 'Curso'
> verbose_name_plural = 'Cursos'
> ordering = ['name']
>
> And here courses/views.py
>
> from django.shortcuts import render, get_object_or_404from django.http import 
> HttpResponse
> from .models import Course
> https://groups.google.com/d/msgid/django-users/CANfN%3DK9zqMGm5hxVMSQsNfS%2ByBKyuMLayv0ARK6ofuT9hg2%2BSg%40mail.gmail.com.


Re: Reg: Django signal not working

2020-04-22 Thread Jorge Gimeno
st, 'authenticate\\register.html', context={'form': 
> form, 'cus_form': cus_form})
>
> Screenshot from the admin panel:
>
> [image: Inline image]
> Please suggest. If you are comfortable we can go on a web meeting where I
> can share my screen and we can work on it.
>
> Regards,
> Amitesh
>
> Sent from Yahoo Mail on Android
> <https://go.onelink.me/107872968?pid=InProduct=Global_Internal_YGrowth_AndroidEmailSig__AndroidUsers_wl=ym_sub1=Internal_sub2=Global_YGrowth_sub3=EmailSignature>
>
> On Sun, 19 Apr 2020 at 19:42, Jorge Gimeno
>  wrote:
> Amitesh,
>
> Where is User.profile defined?
>
> -Jorge
>
> On 4/18/20, Saurabh Ranjan Singh  wrote:
> > I am having the same issue. Please fix it.
> >
> > On Friday, 17 April 2020 22:47:40 UTC+5:30, Amitesh Sahay wrote:
> >>
> >> Hi,
> >>
> >> I am creating a Django signup form through "User" model and
> >> "UserCreationForm" and customized the User model to accommodate single
> >> user
> >> defined field "contact".
> >>
> >> However, the signal that I have written seems not to be working.
> >> Whenever, I am filling the form, I am getting below error:
> >>
> >> AttributeError at /auth/register/
> >> 'User' object has no attribute 'profile'
> >>
> >> *Full traceback log as below:*
> >>
> >> Installed Applications:
> >> ['django.contrib.admin',
> >>  'django.contrib.auth',
> >>  'django.contrib.contenttypes',
> >>  'django.contrib.sessions',
> >>  'django.contrib.messages',
> >>  'django.contrib.staticfiles',
> >>  'phone_field',
> >>  'AUTHENTICATION']
> >> Installed Middleware:
> >> ['django.middleware.security.SecurityMiddleware',
> >>  'django.contrib.sessions.middleware.SessionMiddleware',
> >>  'django.middleware.common.CommonMiddleware',
> >>  'django.middleware.csrf.CsrfViewMiddleware',
> >>  'django.contrib.auth.middleware.AuthenticationMiddleware',
> >>  'django.contrib.messages.middleware.MessageMiddleware',
> >>  'django.middleware.clickjacking.XFrameOptionsMiddleware']
> >>
> >>
> >>
> >> Traceback (most recent call last):
> >>  File "C:\Python38\lib\site-packages\django\core\handlers\exception.py",
> >>
> >> line 34, in inner
> >>response = get_response(request)
> >>  File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line
> >>
> >> 115, in _get_response
> >>response = self.process_exception_by_middleware(e, request)
> >>  File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line
> >>
> >> 113, in _get_response
> >>response = wrapped_callback(request, *callback_args,
> >> **callback_kwargs)
> >>  File "C:\Users\anshu\djago-project\SkoolSkill\AUTHENTICATION\views.py",
> >>
> >> line 50, in register_user
> >>save1 = form.save()
> >>  File "C:\Python38\lib\site-packages\django\contrib\auth\forms.py", line
> >>
> >> 137, in save
> >>user.save()
> >>  File "C:\Python38\lib\site-packages\django\contrib\auth\base_user.py",
> >> line 66, in save
> >>super().save(*args, **kwargs)
> >>  File "C:\Python38\lib\site-packages\django\db\models\base.py", line
> 745,
> >>
> >> in save
> >>self.save_base(using=using, force_insert=force_insert,
> >>  File "C:\Python38\lib\site-packages\django\db\models\base.py", line
> 793,
> >>
> >> in save_base
> >>post_save.send(
> >>  File "C:\Python38\lib\site-packages\django\dispatch\dispatcher.py",
> line
> >>
> >> 173, in send
> >>return [
> >>  File "C:\Python38\lib\site-packages\django\dispatch\dispatcher.py",
> line
> >>
> >> 174, in 
> >>(receiver, receiver(signal=self, sender=sender, **named))
> >>  File
> "C:\Users\anshu\djago-project\SkoolSkill\AUTHENTICATION\models.py",
> >>
> >> line 17, in save_user_profile
> >>instance.profile.save()
> >>
> >> Exception Type: AttributeError at /auth/register/
> >> Exception Value: 'User' object has no attribute 'profile'
> >>
> >> I have uploaded the project in google drive with below location link,
> just
> >>
> >> in case if somebody wishes to test it.
> >>
> >>
> >

Re: CSRF token still needed today?

2020-04-19 Thread Jorge Gimeno
On Sun, Apr 19, 2020 at 1:12 PM guettli 
wrote:

> iI look at this page: https://docs.djangoproject.com/en/3.0/ref/csrf/
> ... and then I look at this page: https://scotthelme.co.uk/csrf-is-dead/
>
> Is a CSRF token still needed today?
>
> All my users use a modern browser.
>
> It would be very nice if I could get rid of the CSRF token.
>
> Is there a safe way to avoid CSRF tokens in  my Django project?
>
> Regards,
>   Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/487c7392-e874-4a1e-a1ff-488ab933ae42%40googlegroups.com
> 
> .
>

For my projects, I am going to keep CSRF tokens. The time taken to put one
in a template is minimal, and I don't run the risk of turning off CSRF
somewhere and having that be the reason for an incident.

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_PepV5HtWE34W-7CR-cQiPTsyv%2BTM5JNA7b7iocH0Uow%40mail.gmail.com.


Re: No Reverse Match Error, When creating a new user (new user application) it should direct back to home (to the core application)

2020-04-19 Thread Jorge Gimeno
I would try to replace return redirect('home') with return
redirect(reverse('home'))

-Jorge

On 4/18/20, Motaz Hejaze  wrote:
> اعمل اسم الفانكشن الحقيقي مكان اسم ال url او استخدم redirect reverse
>
> On Sun, 19 Apr 2020, 6:35 am Ahmed Khairy, 
> wrote:
>
>> For this project, I have made 2 applications: Core and Users
>>
>> Creating a new user is the 2nd application.
>> I am trying to direct the new user after registration to 'home'
>>
>> I keep getting NoReverse Match Error
>>
>> This is the view.py this is the code:
>>
>> def register(request):
>> if request.method == 'POST':
>> form = UserCreationForm(request.POST)
>> if form.is_valid():
>> form.save()
>> username = form.cleaned_data.get('username')
>> messages.success(
>> request, f'Account created for {username}
>> ! Show us your Designs')
>> return redirect('home')
>> else:
>> form = UserCreationForm()
>> return render(request, 'register.html', {'form': form})
>>
>> This is the url.py in the core application:
>>
>> urlpatterns = [
>> path('', HomeView.as_view(), name='home'),
>> path('checkout/', checkout, name='checkout'),
>> path('product//', ItemDetailView.as_view(), name='product'),
>> path('score/', PostListView.as_view(), name='score'),
>> path('register/', user_views.register, name='register'),
>> ]
>>
>>
>> What do I need to do to fix this issue,
>>
>> Thank you all in advance
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4584668f-3cf5-40fe-930c-69c75b74b23d%40googlegroups.com
>> 
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-eymYMWLhd23iEN%2BJqMMkdLNrA9OxHq41x8EuRrj0bh2Q%40mail.gmail.com.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9nwLpqxwFMFdqKM%2B4dpRNZgJ8c5LSU6FoCf%2BgsHVH7oA%40mail.gmail.com.


Re: Tutorial "Writing your first Django App": NoReverseMatch at /polls/ - down at the end of part 3

2020-04-19 Thread Jorge Gimeno
If settings.DEBUG == False, then you have to put the allowed addresses
in settings.ALLOWED_HOSTS.  If Debug is True, then I'm not sure what's
going on.

-Jorge

On 4/18/20, Markus Grossniklaus  wrote:
> Thanks a lot Chucky!
> No error message
> displays at least one dot! fine
>
> http://127.0.0.1:8000/admin/
> shows ERR_CONNECTION_REFUSED
> even with no Proxy active and iptables shows no restrictions e.g.
> everything is allowed
> How could I debug this?
>
>
> On Wednesday, April 15, 2020 at 12:27:21 AM UTC+2, Markus Grossniklaus
> wrote:
>>
>> a) I worked the whole tutorial down to the bottom of part 3
>> b) I connect with the browser to http://127.0.0.1:8000/polls/
>> c) the result is: NoReverseMatch at /polls/
>> d) all project data are attached to this POST in mysite.zip
>> e) I think it cannot be a difficult problem -> does anybody see it?
>> Thanx for any help!
>>
>> [image: NoReverseMatch.PNG]
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f3ecb032-80c9-49bf-89da-e1656752fe89%40googlegroups.com.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-9g60pvGj4%2B2Ls8nhstb%3DUWY%3Di-ew7AC7SrARcq-hCuw%40mail.gmail.com.


Re: Django Project Created in Pycharm using App Engine Does not include Django boiler files

2020-04-19 Thread Jorge Gimeno
I believe you can still install Django the old fashioned way into your
virtual environment, i.e. (with your environment active, and from the
command prompt):

pip install django
django-admin startproject test_project

-Jorgge

On 4/17/20, kelvin smith  wrote:
> Guys, I Just started using google cloud and I'm trying to set up a Django
> app in Pycharm using app Engine.
> I have followed all the steps recommend by JetBrain
>
> But it worries that each time I generate a project it doesn't always
> include the Django files
>
> Here are the steps I followed to generate my app after setting up my local
> machine with GCloud
> I have also downloaded the* app-engine-python-extras*
>
> *Step1:*
>
> [image: Screen Shot 2020-04-18 at 1.08.29 AM.png]
>
> *Step: 2*
>
> [image: Screen Shot 2020-04-18 at 1.08.19 AM.png]
>
> *Step: 3*
>
> [image: Screen Shot 2020-04-18 at 1.10.07 AM.png]
>
>
> And finally, the project is missing the base files
>
> Please I cloud use your help, I've spent so much time trying to figure out
> why and I don't really know what I'm missing.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a274a470-a7ee-48df-a32a-981c1c31bc70%40googlegroups.com.
>

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


Re: Reg: Django signal not working

2020-04-19 Thread Jorge Gimeno
Amitesh,

Where is User.profile defined?

-Jorge

On 4/18/20, Saurabh Ranjan Singh  wrote:
> I am having the same issue. Please fix it.
>
> On Friday, 17 April 2020 22:47:40 UTC+5:30, Amitesh Sahay wrote:
>>
>> Hi,
>>
>> I am creating a Django signup form through "User" model and
>> "UserCreationForm" and customized the User model to accommodate single
>> user
>> defined field "contact".
>>
>> However, the signal that I have written seems not to be working.
>> Whenever, I am filling the form, I am getting below error:
>>
>> AttributeError at /auth/register/
>> 'User' object has no attribute 'profile'
>>
>> *Full traceback log as below:*
>>
>> Installed Applications:
>> ['django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'phone_field',
>>  'AUTHENTICATION']
>> Installed Middleware:
>> ['django.middleware.security.SecurityMiddleware',
>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware']
>>
>>
>>
>> Traceback (most recent call last):
>>   File "C:\Python38\lib\site-packages\django\core\handlers\exception.py",
>>
>> line 34, in inner
>> response = get_response(request)
>>   File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line
>>
>> 115, in _get_response
>> response = self.process_exception_by_middleware(e, request)
>>   File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line
>>
>> 113, in _get_response
>> response = wrapped_callback(request, *callback_args,
>> **callback_kwargs)
>>   File "C:\Users\anshu\djago-project\SkoolSkill\AUTHENTICATION\views.py",
>>
>> line 50, in register_user
>> save1 = form.save()
>>   File "C:\Python38\lib\site-packages\django\contrib\auth\forms.py", line
>>
>> 137, in save
>> user.save()
>>   File "C:\Python38\lib\site-packages\django\contrib\auth\base_user.py",
>> line 66, in save
>> super().save(*args, **kwargs)
>>   File "C:\Python38\lib\site-packages\django\db\models\base.py", line 745,
>>
>> in save
>> self.save_base(using=using, force_insert=force_insert,
>>   File "C:\Python38\lib\site-packages\django\db\models\base.py", line 793,
>>
>> in save_base
>> post_save.send(
>>   File "C:\Python38\lib\site-packages\django\dispatch\dispatcher.py", line
>>
>> 173, in send
>> return [
>>   File "C:\Python38\lib\site-packages\django\dispatch\dispatcher.py", line
>>
>> 174, in 
>> (receiver, receiver(signal=self, sender=sender, **named))
>>   File "C:\Users\anshu\djago-project\SkoolSkill\AUTHENTICATION\models.py",
>>
>> line 17, in save_user_profile
>> instance.profile.save()
>>
>> Exception Type: AttributeError at /auth/register/
>> Exception Value: 'User' object has no attribute 'profile'
>>
>> I have uploaded the project in google drive with below location link, just
>>
>> in case if somebody wishes to test it.
>>
>>
>> https://drive.google.com/file/d/1COB3BBoRb95a85cLi9k1PdIYD3bmlnc0/view?usp=sharing
>>
>> My environment:
>>
>> Django==3.0.5 python 3.8.2
>>
>> Not sure what is the mistake. Please help.
>>
>> *models.py*
>>
>> from django.db import models
>> from django.contrib.auth.models import User
>> from django.db.models.signals import post_save
>> from django.dispatch import receiver
>>
>> class SignUp(models.Model):
>> user = models.OneToOneField(User, on_delete=models.CASCADE)
>> Contact = models.TextField(max_length=500, blank=True)
>>
>> @receiver(post_save, sender=User)
>> def create_user_profile(sender, instance, created, **kwargs):
>> if created:
>> SignUp.objects.create(user=instance)
>>
>> @receiver(post_save, sender=User)
>> def save_user_profile(sender, instance, **kwargs):
>> *instance.profile.save()*
>>
>> *forms.py*
>>
>> from django.contrib.auth.forms import UserCreationForm
>> from django.contrib.auth.models import User
>> from django import forms
>> from  .models import SignUp
>>
>> class SignUpForm(UserCreationForm):
>> email = forms.EmailField()
>> first_name = forms.CharField(max_length=100)
>> last_name = forms.CharField(max_length=100)
>> #phone = format()
>>
>> class Meta:
>> model = User
>> fields = ('username', 'first_name', 'last_name', 'email',
>> 'password1', 'password2')
>>
>>
>> class CustomSignUpPage(forms.ModelForm):
>> Contact = forms.CharField(max_length=10)
>> class Meta:
>> model = SignUp
>> fields = ('Contact', )
>>
>> *views.py*
>>
>> from django.shortcuts import render, redirect
>> from django.contrib.auth import authenticate, login, logout
>> from django.contrib import messages
>> #from django.contrib.auth.forms import UserCreationForm
>> from .forms import 

Re: Django form fields order

2020-04-10 Thread Jorge Gimeno
On Fri, Apr 10, 2020, 12:29 AM אורי  wrote:

> Hi,
>
> We are using Django 2.2 and I want to upgrade to Django 3.0. We have a
> mixin (written in 2017) that add fields to forms:
>
> class LocalizedFirstLastNameMixin(object):
> def __init__(self, *args, **kwargs):
> self.language_code = kwargs.pop('language_code', 'en')
> super().__init__(*args, **kwargs)
> for loc_field in reversed(self.get_localized_fields()):
> self.fields[loc_field] = 
> User._meta.get_field(loc_field).formfield()
> self.fields[loc_field].required = True
> self.fields.move_to_end(loc_field, last=False)
> self.initial[loc_field] = getattr(self.instance, loc_field, '')
>
> It works with Django versions up to 2.2. But when I upgrade to 3.0, I get
> this error message:
>
> AttributeError: 'dict' object has no attribute 'move_to_end'
>
> This function's info:
>
> '''Move an existing element to the end (or beginning if last==False).
>
> And it belongs to OrderedDict.
>
> So I guess we want these fields to be in the beginning of the form fields.
>
> Is there a change in the implementation of the fields in forms and how do
> I specify the order of fields? And if I change it, will it work in previous
> versions such as Django 2.2?
>
> Thanks,
> Uri.
> אורי
> u...@speedy.net
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABD5YeEbHc5ewqJKEFAS5XV1JfD%3DEqf8%3D_ScgjhTC5VY2NsDpw%40mail.gmail.com
> 
> .
>

By chance did you change Python versions as well?

-Jorge

>

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


Re: travis sync issue to git with django project

2020-03-29 Thread Jorge Gimeno
On Sat, Mar 28, 2020 at 3:25 PM John McClain  wrote:

> My build keeps failing at this juncture
>
> 0.00s$ SECRET_KEY="whatever" ./manage.py test
> 273/home/travis/.travis/functions: line 109: ./manage.py: Permission denied
> 274The command "SECRET_KEY="whatever" ./manage.py test" exited with 126.
> 275
> 276
> 277
>
>
>
>
>
> any ideas?
>
>
> --
>
>
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN-hv_ozmpT5qVuDJpkZcmcSyR4UCm8khgt5xr3eEkEDzsPKww%40mail.gmail.com
> 
> .
>

Are you setting the secret key as an enviroment variable?  If so, then I'd
try:

export SECRET_KEY="whatever"
./manage.py test

-Jorge

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


Re: error en ejercicio de principiante, no se que hacer

2020-03-29 Thread Jorge Gimeno
On Sat, Mar 28, 2020, 2:22 PM cosmos multi  wrote:

> Um pues la verdad te estas complicando demasiado solo configura los
> archivos template en settings.py es lo que te recomiendo.
>
> El sáb., 28 mar. 2020, 4:18 p. m., Federico Gomez <
> federicogome...@gmail.com> escribió:
>
>> saludos, tengo un error haciendo una practica en Django con el video
>> Curso Django. Plantillas I. Vídeo 5,
>> https://www.youtube.com/watch?v=iQN0z6MDrEY
>> .
>> Te envio el pantallazo por si puedes identificar el problema. La
>> libreria template no la habia descargado el Django 3.8 y lo que hice fue
>> que la copie de la web de Django y la coloque en la carpeta, no se si
>> eso tenga que ver con el error
>>
>>
>>
>> esta es el archivo Wievs
>>
>> from django.shortcuts import render
>> from django.http import HttpResponse
>> from django.template import Template, context
>>
>> # Create your views here.
>> def hello(request):
>> return HttpResponse("Hola Mi Hermano Para Que Sepas Estoy Mostrando Un 
>> Aviso Por La Web ")
>> def saludo(request):
>> doc_exto=open("D:/django/mytestsite/generar/plantilla.html")
>> plt=Template(doc_exto.read())
>> doc_exto.close()
>> ctx=context()
>> docto=plt.render(ctx)
>> return HttpResponse(docto)
>>
>>
>> este es el urls
>>
>>
>> from django.contrib import admin
>> from django.urls import path
>> from generar.views import hello, saludo
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path("",hello),
>> path("saludo/",saludo),
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3e903965-bdbb-41fc-b9c4-5d4ce335fdad%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Bt%2BYr0EXwWkoArUk2_HDa-zTwbDUNY3buvxom5YBTAcjV-C4Q%40mail.gmail.com
> 
> .
>

Concuerdo con lo que indica Cosmos.  Con eso dicho, el problema, aun que
aparece en la linea 12, es en importar la clase de contexto.  En Django se
llama Context, que es una definicion de clase, y no context, que es un
modulo.  La linea 3 deberia ser:

from django.template import Template, Context

La linea 12 enconces seria ctx = Context()

Suerte!

-Jorge

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


Re: i'm having problems trying to add users to the admin on django for so long now that i haven't been able to learn much about django for months

2020-03-17 Thread Jorge Gimeno
On Tue, Mar 17, 2020 at 8:38 PM chucks ogwo  wrote:

> Environment:
>
>
> Request Method: POST
> Request URL: http://127.0.0.1:8000/admin/auth/user/1/change/
>
> Django Version: 2.0.7
> Python Version: 3.8.2
> Installed Applications:
> ['django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles']
> Installed Middleware:
> ['django.middleware.security.SecurityMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware']
>
>
>
> Traceback:
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\utils.py"
> in _execute
>   85. return self.cursor.execute(sql, params)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\sqlite3\base.py"
> in execute
>   303. return Database.Cursor.execute(self, query, params)
>
> The above exception (no such table: main.auth_user__old) was the direct
> cause of the following exception:
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\core\handlers\exception.py"
> in inner
>   35. response = get_response(request)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\core\handlers\base.py" in
> _get_response
>   128. response = self.process_exception_by_middleware(e,
> request)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\core\handlers\base.py" in
> _get_response
>   126. response = wrapped_callback(request,
> *callback_args, **callback_kwargs)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py"
> in wrapper
>   575. return self.admin_site.admin_view(view)(*args,
> **kwargs)
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\utils\decorators.py"
> in _wrapped_view
>   142. response = view_func(request, *args, **kwargs)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\views\decorators\cache.py"
> in _wrapped_view_func
>   44. response = view_func(request, *args, **kwargs)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\sites.py" in
> inner
>   223. return view(request, *args, **kwargs)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py"
> in change_view
>   1557. return self.changeform_view(request, object_id, form_url,
> extra_context)
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\utils\decorators.py"
> in _wrapper
>   62. return bound_func(*args, **kwargs)
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\utils\decorators.py"
> in _wrapped_view
>   142. response = view_func(request, *args, **kwargs)
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\utils\decorators.py"
> in bound_func
>   58. return func.__get__(self, type(self))(*args2,
> **kwargs2)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py"
> in changeform_view
>   1451. return self._changeform_view(request, object_id,
> form_url, extra_context)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py"
> in _changeform_view
>   1498. self.log_change(request, new_object,
> change_message)
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py"
> in log_change
>   784. return LogEntry.objects.log_action(
>
> File
> "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\models.py" in
> log_action
>   23. return self.model.objects.create(
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\manager.py"
> in manager_method
>   82. return getattr(self.get_queryset(), name)(*args,
> **kwargs)
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\query.py"
> in create
>   417. obj.save(force_insert=True, using=self.db)
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\base.py" in
> save
>   728. self.save_base(using=using, force_insert=force_insert,
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\base.py" in
> save_base
>   759. updated = self._save_table(raw, cls, force_insert,
> force_update, using, update_fields)
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\base.py" in
> _save_table
>   842. result = self._do_insert(cls._base_manager, using,
> fields, update_pk, raw)
>
> File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\base.py" in
> _do_insert
>   879. return manager._insert([self], fields=fields,
> return_id=update_pk,
>
> File 

Re: Django framework on Windows OS

2020-03-17 Thread Jorge Gimeno
On Tue, Mar 17, 2020 at 6:34 PM chucks ogwo  wrote:

> Does anyone here use Django on windows? Cos I have been having a series of
> errors since I started using Django on Windows, even while using the
> windows commands and it has really stunted my learning process of the
> framework
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b61cb0a4-4145-4a87-a4fc-dc9c93cd9a5b%40googlegroups.com
> 
> .
>

I don't have Windows currently installed, but I have used Django on Windows
before.  What are you trying to do, and what happens?  If there's a
traceback please copy and paste into your reply, as this mailing list
strips attachments.

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_QG01kRwsQamHvx4x8xc%3DDWvOSDoiEGROeJtV%2BpYBB6g%40mail.gmail.com.


Re: I AM getting this error plss help me

2020-03-16 Thread Jorge Gimeno
To be pedantic, the object is None.  It's a known issue with Powershell on
Windows.

-Jorge.

On Sun, Mar 15, 2020, 10:12 PM maninder singh Kumar <
maninder.s.ku...@gmail.com> wrote:

> The object is empty
>
>
> [image: --]
>
> Maninder Kumar
> [image: http://]about.me/maninder.s.kumar
> 
>
>
>
>
> On Sat, Mar 14, 2020 at 5:56 PM surendra ediga 
> wrote:
>
>> Traceback (most recent call last):
>>   File "C:\Users\Asus\projects\manage.py", line 21, in 
>> main()
>>   File "C:\Users\Asus\projects\manage.py", line 17, in main
>> execute_from_command_line(sys.argv)
>>   File
>> "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py",
>> line 401, in execute_from_command_line
>> utility.execute()
>>   File
>> "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py",
>> line 395, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py",
>> line 244, in fetch_command
>> klass = load_command_class(app_name, subcommand)
>>   File
>> "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py",
>> line 38, in load_command_class
>> return module.Command()
>> AttributeError: 'NoneType' object has no attribute 'Command'
>> PS C:\Users\Asus\projects>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/df235239-985c-413b-a5d4-1ab5a3c5e69f%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABOHK3TDq6AfmtD%2B9GfmhQKAGayXq9MkGaLb%2Bjs%3Dp9zjVFhuGQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-6VTjrDubmTiRwQoWyb2x_CroUneeE3y%3DhJS_d9whecw%40mail.gmail.com.


Re: I AM getting this error plss help me

2020-03-14 Thread Jorge Gimeno
Can you try closing the powershell, running the Powershell as an admin,
then trying again?

Another option would be to try from the command terminal instead of
Powershell.

Let us know how it goes.

-Jorge

On Sat, Mar 14, 2020 at 5:25 AM surendra ediga 
wrote:

> Traceback (most recent call last):
>   File "C:\Users\Asus\projects\manage.py", line 21, in 
> main()
>   File "C:\Users\Asus\projects\manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File
> "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py",
> line 401, in execute_from_command_line
> utility.execute()
>   File
> "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py",
> line 395, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py",
> line 244, in fetch_command
> klass = load_command_class(app_name, subcommand)
>   File
> "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py",
> line 38, in load_command_class
> return module.Command()
> AttributeError: 'NoneType' object has no attribute 'Command'
> PS C:\Users\Asus\projects>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/df235239-985c-413b-a5d4-1ab5a3c5e69f%40googlegroups.com
> 
> .
>

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


Re: Error while hosting on heroku

2020-03-13 Thread Jorge Gimeno
Have you checked the logs to see what the command returns?

-Jorge

On Fri, Mar 13, 2020 at 11:34 AM shree hari  wrote:

> I tried that too.
> Still its the same.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a3699aff-0872-4baf-8a32-97b49a75e56c%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9uHT-51%3DnLtc2Bp9gij1Xp6gdQrUvoaEw0BOmrs-LNuQ%40mail.gmail.com.


Re: Error while hosting on heroku

2020-03-13 Thread Jorge Gimeno
if you used --app appname, then migrations didn't run.  You can use 'heroku
run python manage.py migrate blog' (without the single quotes) to migrate
the blog app models, or 'heroku run python manage.py migrate' (again
without single quotes) to migrate all the models in the project.

-Jorge

On Fri, Mar 13, 2020 at 9:36 AM shree hari  wrote:

> heroku run python manage.py migrate --app appname
> is the command i used.
>
> On Friday, March 13, 2020 at 9:21:21 PM UTC+5:30, Philip Mitchell wrote:
>>
>> what command did you run fro migrations, you need to run heroku migrate
>> commands
>>
>> On Friday, March 13, 2020 at 6:15:17 PM UTC+3, shree hari wrote:
>>>
>>> here's the paste of the error: https://del.dog/ewoghelahu.txt
>>> have already run makemigrations and migrate. It runs fine on my local
>>> machine. Can somebody please help me ?
>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c6345f03-1d23-4f4e-98cc-f311c6af0c9b%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_Q%2B0AdhqExfEn47gzWpyzPvN-xeQvCe3QzNa11ZoZ%2B4w%40mail.gmail.com.


Re: API documentation

2020-03-11 Thread Jorge Gimeno
On Wed, Mar 11, 2020, 2:03 PM Sunday Iyanu Ajayi 
wrote:

> I am actually ask for API documentation tool that I can use to document my
> API endpoints after building them using django rest framework
> *AJAYI Sunday *
> (+234) 806 771 5394
> *sunnexaj...@gmail.com *
>
>
>
> On Wed, Mar 11, 2020 at 11:05 AM Ayser shuhaib 
> wrote:
>
>> Django Rest Framework is what you need.
>> Check this series of tutorials.
>>
>>  https://youtu.be/iIqMEflK-HM
>>
>> The Documentation:
>> https://www.django-rest-framework.org
>>
>>
>>
>> On Wed, 11 Mar 2020 at 11:59, Sunday Iyanu Ajayi 
>> wrote:
>>
>>> Please can someone recommend an api documentation tool that works with
>>> django
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKYSAw3MMAxmKDiSiTDGz3zTbLM%3D8RtHx1o_%2BtU4zHO3jwX6Xg%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAE0AZGJW71Kqo9%3DVqo7MHRmJykQjXYq4GSsEL3Fw2r%2BWE_6OFA%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKYSAw03z7m%3D1udG%3DOptgsOegVupCrrnXd3GLsX377wKb-rsww%40mail.gmail.com
> 
> .
>

You can try https://drf-yasg.readthedocs.io/en/stable/.

-Jorge

>

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


Re: Beginner needs help getting templates to work - is this the right group?

2020-03-06 Thread Jorge Gimeno
I think Alvaro is on to something.  I just noticed that there ins't a
virtual enviroment active, and the traceback shows that pipenv run wasn't
used either. Can we try pipenv shell and then running python manage.py
runserver again? If you didn't install Django using pipenv install, do that
first.

-Jorge

On Fri, Mar 6, 2020 at 3:07 AM Alvaro Orozco 
wrote:

> It seems like you're not activating the virtual environment. Active the
> virtual environment and install the dependencies.
>
> On Thu, Mar 5, 2020 at 11:02 PM Shishir Jha 
> wrote:
>
>> Can you show the code that you have written until page 55?
>>
>>
>> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>>
>>> Thank you for your response.  The book is Django for Beginners, by
>>> William S. Vincent.  I will copy and send you the chapter I am having
>>> trouble with.  My directory structure, as created by Django, doesn't seem
>>> to be the same as his, so I will send you that as well.  The problem I am
>>> having
>>> is that after the changes to the files have been made, and I "runserver"
>>> (on page 55) I get a huge error dialog that seems to say that django can't
>>> find the app. I have deleted the project several times and re-entered it,
>>> so I think it is unlikely that it is a typing error.
>>>
>>>
>>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno 
>>> wrote:
>>>
>>>>
>>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means 
>>>> wrote:
>>>>
>>>>> I am new to web development.  Wanted to help my daughter with a simple
>>>>> website (she does pet portraits) and learn something that interests me.  I
>>>>> watched some you tube tutorials, then bought a book.  First couple simple
>>>>> projects went OK.  Then I got to templates and I have not been able to get
>>>>> the example project to work.  Been banging my head against the wall for
>>>>> about a week.  Part of the problem is my directory structure does not look
>>>>> like the authors and so I am not sure I am putting things in the right
>>>>> place. When I go searching for another explanation of how to set it up, I
>>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>>> confusing.  At this point I just want to display a simple html page.  If
>>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>>
>>>> Django is a framework that supports a lot of features, and that means
>>>> there's a lot of moving parts.  However, similar to driving a car, you need
>>>> to know a few things to get things working, rather than knowing the
>>>> niceties of how everything works.
>>>>
>>>> To address your point about project structure, there's a lot of
>>>> opinions on this (most of them are subjective). I have a structure I use
>>>> and I'm comfortable with, but Django will support some variety in this.
>>>>
>>>> Without seeing what code you have and what happens that is not
>>>> expected, we don't know where we can help.  So, to help us understand, we
>>>> need to know a few things.
>>>>
>>>> 1.  What steps did you take to get here?
>>>>
>>>> 2..  What goes wrong?  If there's a traceback, copying and pasting it
>>>> is invaluable.
>>>>
>>>> 3.  We may ask to see code.  Again, copying and pasting that will help
>>>> us understand what is going on.
>>>>
>>>> You said that your project isn't working once you get to templates.  Is
>>>> there a book or tutorial you are following?  That might help us know where
>>>> to start.
>>>>
>>>> In addition to this list, there is a forum at forum.djangoproject.com
>>>> (I f

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-05 Thread Jorge Gimeno
On Thu, Mar 5, 2020 at 8:01 PM Shishir Jha  wrote:

> Can you show the code that you have written until page 55?
>
>
> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>
>> Thank you for your response.  The book is Django for Beginners, by
>> William S. Vincent.  I will copy and send you the chapter I am having
>> trouble with.  My directory structure, as created by Django, doesn't seem
>> to be the same as his, so I will send you that as well.  The problem I am
>> having
>> is that after the changes to the files have been made, and I "runserver"
>> (on page 55) I get a huge error dialog that seems to say that django can't
>> find the app. I have deleted the project several times and re-entered it,
>> so I think it is unlikely that it is a typing error.
>>
>>
>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno  wrote:
>>
>>>
>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:
>>>
>>>> I am new to web development.  Wanted to help my daughter with a simple
>>>> website (she does pet portraits) and learn something that interests me.  I
>>>> watched some you tube tutorials, then bought a book.  First couple simple
>>>> projects went OK.  Then I got to templates and I have not been able to get
>>>> the example project to work.  Been banging my head against the wall for
>>>> about a week.  Part of the problem is my directory structure does not look
>>>> like the authors and so I am not sure I am putting things in the right
>>>> place. When I go searching for another explanation of how to set it up, I
>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>> confusing.  At this point I just want to display a simple html page.  If
>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>>> Django is a framework that supports a lot of features, and that means
>>> there's a lot of moving parts.  However, similar to driving a car, you need
>>> to know a few things to get things working, rather than knowing the
>>> niceties of how everything works.
>>>
>>> To address your point about project structure, there's a lot of opinions
>>> on this (most of them are subjective). I have a structure I use and I'm
>>> comfortable with, but Django will support some variety in this.
>>>
>>> Without seeing what code you have and what happens that is not expected,
>>> we don't know where we can help.  So, to help us understand, we need to
>>> know a few things.
>>>
>>> 1.  What steps did you take to get here?
>>>
>>> 2..  What goes wrong?  If there's a traceback, copying and pasting it is
>>> invaluable.
>>>
>>> 3.  We may ask to see code.  Again, copying and pasting that will help
>>> us understand what is going on.
>>>
>>> You said that your project isn't working once you get to templates.  Is
>>> there a book or tutorial you are following?  That might help us know where
>>> to start.
>>>
>>> In addition to this list, there is a forum at forum.djangoproject.com
>>> (I follow posts in there as well).  That might be another resource for you,
>>> as sometimes the question you have has already been answered.
>>>
>>> -Jorge
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.co

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-05 Thread Jorge Gimeno
On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:

> I am new to web development.  Wanted to help my daughter with a simple
> website (she does pet portraits) and learn something that interests me.  I
> watched some you tube tutorials, then bought a book.  First couple simple
> projects went OK.  Then I got to templates and I have not been able to get
> the example project to work.  Been banging my head against the wall for
> about a week.  Part of the problem is my directory structure does not look
> like the authors and so I am not sure I am putting things in the right
> place. When I go searching for another explanation of how to set it up, I
> find that nobody seems to do it the same way.  Also, I find the jargon
> confusing.  At this point I just want to display a simple html page.  If
> this is in the wrong place, maybe someone can direct me to a better one.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
> 
> .
>

Django is a framework that supports a lot of features, and that means
there's a lot of moving parts.  However, similar to driving a car, you need
to know a few things to get things working, rather than knowing the
niceties of how everything works.

To address your point about project structure, there's a lot of opinions on
this (most of them are subjective). I have a structure I use and I'm
comfortable with, but Django will support some variety in this.

Without seeing what code you have and what happens that is not expected, we
don't know where we can help.  So, to help us understand, we need to know a
few things.

1.  What steps did you take to get here?

2..  What goes wrong?  If there's a traceback, copying and pasting it is
invaluable.

3.  We may ask to see code.  Again, copying and pasting that will help us
understand what is going on.

You said that your project isn't working once you get to templates.  Is
there a book or tutorial you are following?  That might help us know where
to start.

In addition to this list, there is a forum at forum.djangoproject.com (I
follow posts in there as well).  That might be another resource for you, as
sometimes the question you have has already been answered.

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com.


Re: progress bar and upload big file and protect files

2020-03-04 Thread Jorge Gimeno
On Wed, Mar 4, 2020 at 8:40 AM Alaydyn Gholechragh 
wrote:

> Hi
> I search a lot in Google to find best methods for uploads big file with
> progressbar to my site and i can't find any solution
> And other things for protecting my file (zip or rar) from Anonymous user..
> Because I want to create a web site for selling some files
>
> Please help me and give me best example and methods
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/15d70b91-accf-4a54-bd24-f6715f072513%40googlegroups.com
> .
>

There's a package you can check out called tqdm.  It's on PyPI here:
https://pypi.org/project/tqdm/. 

There's good docs there.  Integrating it I leave as an exercise to you.

-Jorge

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


Re: ValueError: set_wakeup_fd only works in main thread on Apache2.4.41 + Python 3.8.1 + Django 3.0.2 + MySQL 8.0.19

2020-02-22 Thread Jorge Gimeno
On Sat, Feb 22, 2020 at 9:02 PM Siddharth Agarwal 
wrote:

> Hello
> When I run my Django Web application with Apache2.4.41 + Python 3.8.1 +
> Django 3.0.2 + MySQL 8.0.19 on Windows 10 Professional 64 bit version it
> throws Value Error at /. set_wakeup_fd only works in main thread.
>
> This issue was a result of regression in Python 3.8 and was fixed in
> November in later builds of Python. For more details -
> https://bugs.python.org/issue38563.
>
> Stacktrace of the error is as follows -
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://127.0.0.1/
>
> Django Version: 3.0.2
> Python Version: 3.8.1
> Installed Applications:
> ['Analysis.apps.AnalysisConfig',
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'django.contrib.humanize']
> Installed Middleware:
> ['django.middleware.security.SecurityMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware']
>
>
>
> Traceback (most recent call last):
>   File "c:\python38\lib\site-packages\django\core\handlers\exception.py",
> line 34, in inner
> response = get_response(request)
>   File "c:\python38\lib\site-packages\django\core\handlers\base.py", line
> 115, in _get_response
> response = self.process_exception_by_middleware(e, request)
>   File "c:\python38\lib\site-packages\django\core\handlers\base.py", line
> 113, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs
> )
>   File "F:\IndianMarketAnalysis\ISMA\Analysis\views.py", line 8, in home
> date_list = dict(d.date_list())
>   File "F:\IndianMarketAnalysis\ISMA\Analysis\models.py", line 7, in
> date_list
> with connection.cursor() as cursor:
>   File "c:\python38\lib\site-packages\django\utils\asyncio.py", line 19,
> in inner
> event_loop = asyncio.get_event_loop()
>   File "c:\python38\lib\asyncio\events.py", line 636, in get_event_loop
> self.set_event_loop(self.new_event_loop())
>   File "c:\python38\lib\asyncio\events.py", line 656, in new_event_loop
> return self._loop_factory()
>   File "c:\python38\lib\asyncio\windows_events.py", line 310, in __init__
> super().__init__(proactor)
>   File "c:\python38\lib\asyncio\proactor_events.py", line 632, in __init__
> signal.set_wakeup_fd(self._csock.fileno())
>
> Exception Type: ValueError at /
> Exception Value: set_wakeup_fd only works in main thread
>
>
>
> Further, this application works very well on local Development Environment
> using - python manage.py runserver.
>
> Please suggest the next steps to move forward.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5dceb145-7d89-4bd0-a3cf-24dd5155891a%40googlegroups.com
> 
> .
>

 This is fixed and will be released with 3.8.2, per what I've read.  If
running 3.8.2 release candidate 2 isn't an option, is downgrading to Python
3.7 an option?

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-A7K_p4oy%2B4a99xWWphk7e4ZzzY%2BxqwggZRSSK4jGVyQ%40mail.gmail.com.


Re: NoReverseMatch() error while learning Python

2020-02-19 Thread Jorge Gimeno
On Wed, Feb 19, 2020 at 4:47 AM DamnGeniuses' Squad <
andhikaravelen...@gmail.com> wrote:

> NoReverseMatch at /polls/1/
>
> Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: 
> ['polls/(?P[0-9]+)/vote/$']
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/polls/1/
> Django Version: 3.0.3
> Exception Type: NoReverseMatch
> Exception Value:
>
> Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: 
> ['polls/(?P[0-9]+)/vote/$']
>
> Exception Location: 
> C:\Users\Andhika\AppData\Local\Programs\Python\Python38\lib\site-packages\django\urls\resolvers.py
> in _reverse_with_prefix, line 677
> Python Executable:
> C:\Users\Andhika\AppData\Local\Programs\Python\Python38\python.exe
> Python Version: 3.8.1
> Python Path:
>
> ['E:\\TestingKetiga-2\\mysite',
>  
> 'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip',
>  'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38\\DLLs',
>  'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38\\lib',
>  'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38',
>  'C:\\Users\\Andhika\\AppData\\Roaming\\Python\\Python38\\site-packages',
>  
> 'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages']
>
> Server time: Wed, 19 Feb 2020 09:56:21 +
> Error during template rendering
>
> In template E:\TestingKetiga-2\mysite\polls\templates\polls\detail.html,
> error at line *5*
> Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried:
> ['polls/(?P[0-9]+)/vote/$']
> 1 {{ question.question_text }}
> 2
> 3 {% if error_message %}{{ error_message }}{%
> endif %}
> 4
> 5 
> 6 {% csrf_token %}
> 7 {% for choice in question.choice_set.all %}
> 8  value="{{ choice.id }}">
> 9 {{ choice.choice_text
> }}
> 10 {% endfor %}
> 11 
> 12 
> Please help me fix this , i want to learn more about Django , but i
> already searching for 3 hours but got no solution yet
> Thankyouu
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b5374455-e259-4ac7-b16d-2b55c8dd6924%40googlegroups.com
> 
> .
>

Would you be able to show us your polls/urls.py and your mysite/urls.py
please?

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-v801hrCxQ%2B6Em_Wfu%3D5p8ZYw9xZHOoA_jN7x3Y0_WFg%40mail.gmail.com.


Re: pyodbc in umbutu 19.10

2020-02-18 Thread Jorge Gimeno
On Tue, Feb 18, 2020, 11:55 AM Elias Coutinho 
wrote:

> This is my return:
>
>
> elias@eliasPai:~$ sudo apt install unixodbc-dev
> Lendo listas de pacotes... Pronto
> Construindo árvore de dependências
> Lendo informação de estado... Pronto
> Alguns pacotes não puderam ser instalados. Isto pode significar que
> você solicitou uma situação impossível ou, se você está usando a
> distribuição instável, que alguns pacotes requeridos não foram
> criados ainda ou foram retirados da "Incoming".
> A informação a seguir pode ajudar a resolver a situação:
>
> Os pacotes a seguir têm dependências desencontradas:
>  unixodbc-dev : Depende: unixodbc (= 2.3.7)
> Depende: odbcinst1debian2 (= 2.3.7) mas não será instalado
> E: Impossível corrigir problemas, você manteve (hold) pacotes quebrados.
>
> Em ter., 18 de fev. de 2020 às 16:07, Jorge Gimeno 
> escreveu:
>
>> There may be development libraries missing. An internet search found
>> this:
>>
>> sudo apt install unixodbc-dev
>>
>> Hope it helps!
>>
>> -Jorge
>>
>>
>>
>> On Tue, Feb 18, 2020, 10:49 AM Elias Coutinho 
>> wrote:
>>
>>> Good afternoon people.
>>>
>>>
>>> Out of curiosity I installed SQL Server on Linux.
>>>
>>>
>>> I restored a database and made basic commands. Working properly!
>>>
>>>
>>>
>>> I have a connection I made to a .py file to make queries and run stored
>>> procedures. It also works on windows.
>>>
>>>
>>>
>>> As I wanted to have a SQL Server SGDB and I didn't want a virtual
>>> machine, it was setting up an optimal environment.
>>>
>>> but when running my .py file I missed pyodbc and when installing it
>>> returned an error and does not install.
>>>
>>>
>>>
>>> Below the log, something caught my attention, I highlighted it in bold:
>>>
>>>
>>>
>>> elias @ eliasPai: ~ $ pip3 install pyodbc
>>> Collecting pyodbc
>>> Using cached pyodbc-4.0.28.tar.gz (264 kB)
>>> Installing collected packages: pyodbc
>>> Running setup.py install for pyodbc… error
>>> ERROR: Command errored out with exit status 1:
>>> command: /home/elias/.pyenv/versions/3.8.1/bin/python3.8 -u -c ‘import
>>> sys, setuptools, tokenize; sys.argv [0] = ‘" ’"
>>> ’/tmp/pip-install-07bga8vp/pyodbc/setup.py’ "’ "’; file = '"'" '/ tmp /
>>> pip-install-07bga8vp / pyodbc / setup.py' "'"'; f = getattr (tokenize, '"'"
>>> 'open' "'"', open) (file) ; code = f.read (). replace ('"'" '\ r \ n' "'"',
>>> '"'" '\ n' "'"'); f.close (); exec (compile ( code, file, '"'" 'exec'
>>> "'"')) 'install --record /tmp/pip-record-2nc3ppfp/install-record.txt
>>> --single-version-externally-managed --compile - install-headers
>>> /home/elias/.pyenv/versions/3.8.1/include/python3.8/pyodbc
>>> cwd: / tmp / pip-install-07bga8vp / pyodbc /
>>> Complete output (14 lines):
>>> running install
>>> running build
>>> running build_ext
>>> building ‘pyodbc’ extension
>>> creating build
>>> creating build / temp.linux-x86_64-3.8
>>> creating build / temp.linux-x86_64-3.8 / src
>>> gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3
>>> -Wall -fPIC -DPYODBC_VERSION = 4.0.28 -I / home / elias / .pyenv / versions
>>> / 3.8.1 / include / python3 .8 -c src / buffer.cpp -o build /
>>> temp.linux-x86_64-3.8 / src / buffer.o -Wno-write-strings
>>> In file included from src / buffer.cpp: 12:
>>> src / pyodbc.h: 56: 10: fatal error: sql.h: File or directory does not
>>> exist
>>> 56 | #include 
>>> ** | ^ ~~ **
>>> ** compilation terminated. **
>>> error: command ‘gcc’ failed with exit status 1
>>> 
>>> ERROR: Command errored out with exit status 1:
>>> /home/elias/.pyenv/versions/3.8.1/bin/python3.8 -u -c ‘import sys,
>>> setuptools, tokenize; sys.argv [0] = ‘" ’"
>>> ’/tmp/pip-install-07bga8vp/pyodbc/setup.py’ "’ "’; file = '"'" '/ tmp /
>>> pip-install-07bga8vp / pyodbc / setup.py' "'"'; f = getattr (tokenize, '"'"
>>> 'open' "'"', open) (file) ; code = f.read (). replace ('"'" '\ r \ n' "'"',
>>> '"'" '\ n' "'"'); f.close (); exec (compile ( code, file,

Re: pyodbc in umbutu 19.10

2020-02-18 Thread Jorge Gimeno
There may be development libraries missing. An internet search found this:

sudo apt install unixodbc-dev

Hope it helps!

-Jorge



On Tue, Feb 18, 2020, 10:49 AM Elias Coutinho 
wrote:

> Good afternoon people.
>
>
> Out of curiosity I installed SQL Server on Linux.
>
>
> I restored a database and made basic commands. Working properly!
>
>
>
> I have a connection I made to a .py file to make queries and run stored
> procedures. It also works on windows.
>
>
>
> As I wanted to have a SQL Server SGDB and I didn't want a virtual machine,
> it was setting up an optimal environment.
>
> but when running my .py file I missed pyodbc and when installing it
> returned an error and does not install.
>
>
>
> Below the log, something caught my attention, I highlighted it in bold:
>
>
>
> elias @ eliasPai: ~ $ pip3 install pyodbc
> Collecting pyodbc
> Using cached pyodbc-4.0.28.tar.gz (264 kB)
> Installing collected packages: pyodbc
> Running setup.py install for pyodbc… error
> ERROR: Command errored out with exit status 1:
> command: /home/elias/.pyenv/versions/3.8.1/bin/python3.8 -u -c ‘import
> sys, setuptools, tokenize; sys.argv [0] = ‘" ’"
> ’/tmp/pip-install-07bga8vp/pyodbc/setup.py’ "’ "’; file = '"'" '/ tmp /
> pip-install-07bga8vp / pyodbc / setup.py' "'"'; f = getattr (tokenize, '"'"
> 'open' "'"', open) (file) ; code = f.read (). replace ('"'" '\ r \ n' "'"',
> '"'" '\ n' "'"'); f.close (); exec (compile ( code, file, '"'" 'exec'
> "'"')) 'install --record /tmp/pip-record-2nc3ppfp/install-record.txt
> --single-version-externally-managed --compile - install-headers
> /home/elias/.pyenv/versions/3.8.1/include/python3.8/pyodbc
> cwd: / tmp / pip-install-07bga8vp / pyodbc /
> Complete output (14 lines):
> running install
> running build
> running build_ext
> building ‘pyodbc’ extension
> creating build
> creating build / temp.linux-x86_64-3.8
> creating build / temp.linux-x86_64-3.8 / src
> gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3
> -Wall -fPIC -DPYODBC_VERSION = 4.0.28 -I / home / elias / .pyenv / versions
> / 3.8.1 / include / python3 .8 -c src / buffer.cpp -o build /
> temp.linux-x86_64-3.8 / src / buffer.o -Wno-write-strings
> In file included from src / buffer.cpp: 12:
> src / pyodbc.h: 56: 10: fatal error: sql.h: File or directory does not
> exist
> 56 | #include 
> ** | ^ ~~ **
> ** compilation terminated. **
> error: command ‘gcc’ failed with exit status 1
> 
> ERROR: Command errored out with exit status 1:
> /home/elias/.pyenv/versions/3.8.1/bin/python3.8 -u -c ‘import sys,
> setuptools, tokenize; sys.argv [0] = ‘" ’"
> ’/tmp/pip-install-07bga8vp/pyodbc/setup.py’ "’ "’; file = '"'" '/ tmp /
> pip-install-07bga8vp / pyodbc / setup.py' "'"'; f = getattr (tokenize, '"'"
> 'open' "'"', open) (file) ; code = f.read (). replace ('"'" '\ r \ n' "'"',
> '"'" '\ n' "'"'); f.close (); exec (compile ( code, file, '"'" 'exec'
> "'"')) 'install --record /tmp/pip-record-2nc3ppfp/install-record.txt
> --single-version-externally-managed --compile - install-headers
> /home/elias/.pyenv/versions/3.8.1/include/python3.8/pyodbc Check the logs
> for full command output.
>
>
>
>
>
> Then I tried to install several times using:
> python3 -m pip install --upgrade pip
> pip3 install setuptools
> pip install --upgrade setuptools
>
> Does anyone have a tip?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7b007da3-4721-434a-8710-e2a4e8b526b5%40googlegroups.com
> 
> .
>

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


Re: 'list' object is not callable

2020-02-13 Thread Jorge Gimeno
On Thu, Feb 13, 2020 at 7:16 PM Bhoopesh sisoudiya 
wrote:

> Hi all,
>
> How to resolve this exception in generic view of rest-framework- api
> Exception===
> 2020-02-14 08:30:33,523 - D:\futuredatapoints\futuredatapoints\logs\
> 14022020.log - ERROR
> ERROR:D:\futuredatapoints\futuredatapoints\logs\14022020.log:
> %% Exception
>  Start %%
> 2020-02-14 08:30:33,523 - D:\futuredatapoints\futuredatapoints\logs\
> 14022020.log - ERROR
> 2020-02-14 08:30:33,523 - D:\futuredatapoints\futuredatapoints\logs\
> 14022020.log - ERROR
> ERROR:D:\futuredatapoints\futuredatapoints\logs\14022020
> .log:Traceback (most recent call last):
>   File
> "D:\futuredatapoints\env\lib\site-packages\django\core\handlers\base.py"
> , line 124, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>   File
> "D:\futuredatapoints\env\lib\site-packages\django\views\decorators\csrf.py"
> , line 54, in wrapped_view
> return view_func(*args, **kwargs)
>   File
> "D:\futuredatapoints\env\lib\site-packages\django\views\generic\base.py"
> , line 68, in view
> return self.dispatch(request, *args, **kwargs)
>   File "D:\futuredatapoints\env\lib\site-packages\rest_framework\views.py"
> , line 479, in dispatch
> request = self.initialize_request(request, *args, **kwargs)
>   File "D:\futuredatapoints\env\lib\site-packages\rest_framework\views.py"
> , line 380, in initialize_request
> authenticators=self.get_authenticators(),
>   File "D:\futuredatapoints\env\lib\site-packages\rest_framework\views.py"
> , line 274, in get_authenticators
> return [auth() for auth in self.authentication_classes]
>   File "D:\futuredatapoints\env\lib\site-packages\rest_framework\views.py"
> , line 274, in 
> return [auth() for auth in self.authentication_classes]
> TypeError: 'list' object is not callable
>
> WARNING:django.request:Bad Request: /api/send/otp/
>
>
> url== ===
> url(r'^api/send/data/$',UserViewSetCustom.as_view(),name=
> 'user-view-set-custom'),
>
>
>  view generic class 
> class UserViewSetCustom(generics.CreateAPIView):
> """
> A simple CreateAPIView that for sending otp for user.
> """
> # permission_classes = (AllowAny,)
> authentication_classes = [TokenAuthentication,],
> queryset = User.objects.all()
> def create(self, request):
> print("***")
> return Response(
> data=jsonResponse([],
> msg=Message.getMessage('NOT_ALLOWED'),
> status=status.HTTP_200_OK),
> status=status.HTTP_200_OK,
> )
>
> Thanks
> Bhoopesh Sisoudiya
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAk3c1N0JBOFkF7tyMLJdMY3bh3H54r-QVh6_x-KW9peaRo9dA%40mail.gmail.com
> 
> .
>

I did some experimenting in the Python shell.   What I found is this:

 jlgimeno@jlgimeno-Lenovo-G50-45  ~  python3.8
Python 3.8.1 (default, Dec 31 2019, 11:21:33)
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = [1]
>>> b = [1,]
>>> c = [1,],
>>> a
[1]
>>> b
[1]
>>> c
([1],)

The variables a and b are both lists with a single object, but c is
different.  It is a tuple, with the first (and only) element is a list.  c
is similar to your authentication_classes variable in your view because of
that trailing comma which makes it a tuple.  As you can see in the last two
lines of your traceback, django rest framework is trying to get a list of
authenticators using a list comprehension, by calling each class that is an
element of self.authentication_classes.  It's not getting a callable back,
it's getting back a list.  Lists are not callables, and so Python raises an
exception.

To fix this, remove the trailing comma in your authentication_classes
variable like so:
authentication_classes = [TokenAuthentication,]

That should work. Hope this helped!

-Jorge

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


Re: Trouble after create a pool

2020-02-13 Thread Jorge Gimeno
On Thu, Feb 13, 2020, 10:49 AM Rodrigo Silva <
carvalhaes.silva.rodr...@gmail.com> wrote:

>Hi, I'm starting in django and learning about the tutorials.
> After I have been created and set up, when I run the server the shell show
> me a error
>
> Someone can help me? Than you!
>
> C:\Users\carva\mysite>python manage.py runserver
> Watching for file changes with StatReloader
> Performing system checks...
>
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\threading.py",
> line 932, in _bootstrap_inner
> self.run()
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\threading.py",
> line 870, in run
> self._target(*self._args, **self._kwargs)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\utils\autoreload.py",
> line 53, in wrapper
> fn(*args, **kwargs)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\core\management\commands\runserver.py",
> line 117, in inner_run
> self.check(display_num_errors=True)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\core\management\base.py",
> line 392, in check
> all_issues = self._run_checks(
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\core\management\base.py",
> line 382, in _run_checks
> return checks.run_checks(**kwargs)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\core\checks\registry.py",
> line 72, in run_checks
> new_errors = check(app_configs=app_configs)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\core\checks\urls.py",
> line 13, in check_url_config
> return check_resolver(resolver)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\core\checks\urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\urls\resolvers.py",
> line 407, in check
> for pattern in self.url_patterns:
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\utils\functional.py",
> line 48, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\urls\resolvers.py",
> line 588, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\utils\functional.py",
> line 48, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\urls\resolvers.py",
> line 581, in urlconf_module
> return import_module(self.urlconf_name)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
> line 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1014, in _gcd_import
>   File "", line 991, in _find_and_load
>   File "", line 975, in
> _find_and_load_unlocked
>   File "", line 671, in _load_unlocked
>   File "", line 783, in exec_module
>   File "", line 219, in
> _call_with_frames_removed
>   File "C:\Users\carva\mysite\mysite\urls.py", line 20, in 
> path('pools/', include('pools.urls')),
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\urls\conf.py",
> line 34, in include
> urlconf_module = import_module(urlconf_module)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
> line 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1014, in _gcd_import
>   File "", line 991, in _find_and_load
>   File "", line 961, in
> _find_and_load_unlocked
>   File "", line 219, in
> _call_with_frames_removed
>   File "", line 1014, in _gcd_import
>   File "", line 991, in _find_and_load
>   File "", line 973, in
> _find_and_load_unlocked
> ModuleNotFoundError: No module named 'pools'
> Traceback (most recent call last):
>   File "manage.py", line 21, in 
> main()
>   File "manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File
> "C:\Users\carva\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django-3.0.3-py3.8.egg\django\core\management\__init__.py",
> line 401, in 

Re: 404 error

2020-02-12 Thread Jorge Gimeno
On Wed, Feb 12, 2020 at 2:29 PM mahshid asadi 
wrote:

> Hi everyone. Im a beginner. i use this sites tutorial and still i cant fix
> the 404 error,please someone help me.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d7ce0e72-20a3-40eb-9f9c-a910389b09f0%40googlegroups.com
> 
> .
>

Errors are frustrating!  As much as we may want to, we can't help without
some further information.  Since a 404 indicates that the page cannot be
found, we need at minimum the urls.py files involved.  Also, the traceback
in the terminal would be useful.  Cut and paste, please.  This list strips
attachments.

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9yc%2BUvdn%2B4MTf4rKPk3A%2Bh7ARGBHp1dAMpJ0GquCRDHw%40mail.gmail.com.


Re: Django local host connection aborted

2020-02-05 Thread Jorge Gimeno
On Wed, Feb 5, 2020, 4:34 AM Ayser shuhaib 
wrote:

> Can you send your settings.py file please.
>
> On Wed, 05 Feb 2020 at 14:30, yazan bader 
> wrote:
>
>>  am having new issue when running Django localhost 127.0.0.1:8000 as
>> connection getting aborted ,this is new for me as I am working with Django
>> from 3 month and cant find solution for it.
>>
>> below is the Exception i got:
>>
>> Exception happened during processing of request from ('127.0.0.1', 
>> 50501)Traceback (most recent call last):
>>   File "C:\Users\Yazan 
>> Bader\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 650, 
>> in process_request_thread
>> self.finish_request(request, client_address)
>>   File "C:\Users\Yazan 
>> Bader\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 360, 
>> in finish_request
>> self.RequestHandlerClass(request, client_address, self)
>>   File "C:\Users\Yazan 
>> Bader\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 720, 
>> in __init__
>> self.handle()
>>   File "C:\Users\Yazan 
>> Bader\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py",
>>  line 174, in handle
>> self.handle_one_request()
>>   File "C:\Users\Yazan 
>> Bader\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py",
>>  line 182, in handle_one_request
>> self.raw_requestline = self.rfile.readline(65537)
>>   File "C:\Users\Yazan 
>> Bader\AppData\Local\Programs\Python\Python37\lib\socket.py", line 589, in 
>> readinto
>> return self._sock.recv_into(b)ConnectionAbortedError: [WinError 10053] 
>> An established connection was aborted by the software in your host machine
>>
>> any help pls?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/0812e223-c9ed-4836-856f-1406606f1234%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE0AZGKTBsv7skLt1jzNCm1h9JLdvD%2BSAwWWqCGm%3D-9ScVcK%2Bg%40mail.gmail.com
> 
> .
>

I vaguely remember having this problem on Windows. Are you able to try to
run your project under Python 3.8 and see if that helps?

-Jorge

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


Re: Big Problem After Going Live: NoReverseMatch at /login/ Reverse for 'password_reset' not found. 'password_reset' is not a valid view function or pattern name

2020-01-31 Thread Jorge Gimeno
I apologize to the list for posting all the emails to everyone.  I'll keep
this going off list.


-Jorge


On Fri, Jan 31, 2020 at 10:09 PM Jorge Gimeno  wrote:

> What I believe is going on is that Django is looking for the password
> reset view at password_reset, and that url path doesn't exist anywhere in
> urls.py.  I see a path named "password-reset", which won't match.
>
> Let's try to rename that url conf to password_reset, and leave the rest
> unchanged.  Does anything change?
>
> -Jorge
>
> On Fri, Jan 31, 2020 at 9:21 PM Dave Ko  wrote:
>
>>
>> LOGIN_REDIRECT_URL = 'news:all_news'
>>
>>
>> all_news is the first page of the website
>>
>> On Saturday, February 1, 2020 at 1:16:53 PM UTC+8, jlgimeno71 wrote:
>>>
>>>
>>>
>>> On Fri, Jan 31, 2020 at 8:33 PM Dave Ko  wrote:
>>>
>>>>  I also have some trouble with using signal, which works perfectly fine
>>>> on localhost but not deployed
>>>>
>>>>
>>>> On Saturday, February 1, 2020 at 12:20:29 PM UTC+8, jlgimeno71 wrote:
>>>>>
>>>>>
>>>>> On Fri, Jan 31, 2020 at 5:35 PM Dave Ko  wrote:
>>>>>
>>>>>> Hi everyone,
>>>>>>
>>>>>> I am pretty new to django programming, I was following a tutorial and
>>>>>> try to set up a blog,
>>>>>> everything seems to fine on my localhost machine, but after
>>>>>> deployment and fixing some bugs,
>>>>>> I run into a problem which I have no idea what to do even with hours
>>>>>> of search on stackoverflow.
>>>>>>
>>>>>> So, here is my problem, I have made a login page, register page.
>>>>>> After deployment there is not other users besides admin,
>>>>>> but after register, when i try to login, it goes to error page you
>>>>>> can see over here roasitas.com/login/
>>>>>>
>>>>>> [image: Screenshot 2020-02-01 at 9.27.48 AM.png]
>>>>>>
>>>>>> here is my urls.py
>>>>>>
>>>>>> I really want finish this blog and keep building it please help me
>>>>>> out, thanks in advance!
>>>>>>
>>>>>>
>>>>>> from django.conf.urls.static import static
>>>>>> from rest_framework import routers, serializers, viewsets
>>>>>> from users import views as users_view
>>>>>> from django.contrib.auth import views as auth_views
>>>>>> from news import views as news_views
>>>>>> from news.models import Writer, News
>>>>>> from news.serializers import UserSerializer, NewsSerializer
>>>>>>
>>>>>> urlpatterns = [
>>>>>>path('',include('news.urls', namespace="news")),
>>>>>>path('admin/', admin.site.urls),
>>>>>>path('register/', users_view.register, name='register'),
>>>>>>path('profile/', users_view.profile, name='profile'),
>>>>>>path('login/', auth_views.LoginView.as_view(template_name=
>>>>>> 'users/login.html'), name='login'),
>>>>>>path('logout/', auth_views.LogoutView.as_view(template_name=
>>>>>> 'users/logout.html'), name='logout'),
>>>>>>path('password-reset/',
>>>>>> auth_views.PasswordResetView.as_view(
>>>>>>template_name='users/password_reset.html',
>>>>>>subject_template_name='users/password_reset_subject.txt',
>>>>>>success_url=reverse_lazy('users:password_reset_done')
>>>>>> ),
>>>>>> name='password_reset'),
>>>>>>
>>>>>> path('password-reset/done/',
>>>>>> auth_views.PasswordResetDoneView.as_view(
>>>>>> template_name='users/password_reset_done.html'
>>>>>> ),
>>>>>> name='password_reset_done'),
>>>>>>
>>>>>> path('password-reset-confirm///',
>>>>>>auth_views.PasswordResetConfirmView.as_view(
>>>>>>template_name='users/password_reset_confirm.html'
>>>>>>),
>>>>>>name='password_reset_confirm'),
>>>>>>
>>>>>>  path('password-reset-complete/',
>>>>

Re: Big Problem After Going Live: NoReverseMatch at /login/ Reverse for 'password_reset' not found. 'password_reset' is not a valid view function or pattern name

2020-01-31 Thread Jorge Gimeno
What I believe is going on is that Django is looking for the password reset
view at password_reset, and that url path doesn't exist anywhere in
urls.py.  I see a path named "password-reset", which won't match.

Let's try to rename that url conf to password_reset, and leave the rest
unchanged.  Does anything change?

-Jorge

On Fri, Jan 31, 2020 at 9:21 PM Dave Ko  wrote:

>
> LOGIN_REDIRECT_URL = 'news:all_news'
>
>
> all_news is the first page of the website
>
> On Saturday, February 1, 2020 at 1:16:53 PM UTC+8, jlgimeno71 wrote:
>>
>>
>>
>> On Fri, Jan 31, 2020 at 8:33 PM Dave Ko  wrote:
>>
>>>  I also have some trouble with using signal, which works perfectly fine
>>> on localhost but not deployed
>>>
>>>
>>> On Saturday, February 1, 2020 at 12:20:29 PM UTC+8, jlgimeno71 wrote:


 On Fri, Jan 31, 2020 at 5:35 PM Dave Ko  wrote:

> Hi everyone,
>
> I am pretty new to django programming, I was following a tutorial and
> try to set up a blog,
> everything seems to fine on my localhost machine, but after deployment
> and fixing some bugs,
> I run into a problem which I have no idea what to do even with hours
> of search on stackoverflow.
>
> So, here is my problem, I have made a login page, register page.
> After deployment there is not other users besides admin,
> but after register, when i try to login, it goes to error page you can
> see over here roasitas.com/login/
>
> [image: Screenshot 2020-02-01 at 9.27.48 AM.png]
>
> here is my urls.py
>
> I really want finish this blog and keep building it please help me
> out, thanks in advance!
>
>
> from django.conf.urls.static import static
> from rest_framework import routers, serializers, viewsets
> from users import views as users_view
> from django.contrib.auth import views as auth_views
> from news import views as news_views
> from news.models import Writer, News
> from news.serializers import UserSerializer, NewsSerializer
>
> urlpatterns = [
>path('',include('news.urls', namespace="news")),
>path('admin/', admin.site.urls),
>path('register/', users_view.register, name='register'),
>path('profile/', users_view.profile, name='profile'),
>path('login/', auth_views.LoginView.as_view(template_name=
> 'users/login.html'), name='login'),
>path('logout/', auth_views.LogoutView.as_view(template_name=
> 'users/logout.html'), name='logout'),
>path('password-reset/',
> auth_views.PasswordResetView.as_view(
>template_name='users/password_reset.html',
>subject_template_name='users/password_reset_subject.txt',
>success_url=reverse_lazy('users:password_reset_done')
> ),
> name='password_reset'),
>
> path('password-reset/done/',
> auth_views.PasswordResetDoneView.as_view(
> template_name='users/password_reset_done.html'
> ),
> name='password_reset_done'),
>
> path('password-reset-confirm///',
>auth_views.PasswordResetConfirmView.as_view(
>template_name='users/password_reset_confirm.html'
>),
>name='password_reset_confirm'),
>
>  path('password-reset-complete/',
> auth_views.PasswordResetCompleteView.as_view(
> template_name='users/password_reset_complete.html'
> ),
> name='password_reset_complete'),
>
> path('api/', include(router.urls)),
>path('api-auth/', include('rest_framework.urls', namespace=
> 'rest_framework')),
>path('/tinymce/', include('tinymce.urls')),
>
> ]
>
> if settings.DEBUG:
>urlpatterns += static(settings.MEDIA_URL, document_root=settings.
> MEDIA_ROOT)
>
>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/561c6b97-6428-4af2-a1dc-09af93387b77%40googlegroups.com
> 
> .
>

 I attempted to create an account and log in, and it worked for me! Your
 urls don't have a path to password_reset in the url.  That's the usual
 culprit for that exception to be raised.

 -Jorge

>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> 

Re: Big Problem After Going Live: NoReverseMatch at /login/ Reverse for 'password_reset' not found. 'password_reset' is not a valid view function or pattern name

2020-01-31 Thread Jorge Gimeno
On Fri, Jan 31, 2020 at 8:33 PM Dave Ko  wrote:

>  I also have some trouble with using signal, which works perfectly fine on
> localhost but not deployed
>
>
> On Saturday, February 1, 2020 at 12:20:29 PM UTC+8, jlgimeno71 wrote:
>>
>>
>> On Fri, Jan 31, 2020 at 5:35 PM Dave Ko  wrote:
>>
>>> Hi everyone,
>>>
>>> I am pretty new to django programming, I was following a tutorial and
>>> try to set up a blog,
>>> everything seems to fine on my localhost machine, but after deployment
>>> and fixing some bugs,
>>> I run into a problem which I have no idea what to do even with hours of
>>> search on stackoverflow.
>>>
>>> So, here is my problem, I have made a login page, register page.
>>> After deployment there is not other users besides admin,
>>> but after register, when i try to login, it goes to error page you can
>>> see over here roasitas.com/login/
>>>
>>> [image: Screenshot 2020-02-01 at 9.27.48 AM.png]
>>>
>>> here is my urls.py
>>>
>>> I really want finish this blog and keep building it please help me out,
>>> thanks in advance!
>>>
>>>
>>> from django.conf.urls.static import static
>>> from rest_framework import routers, serializers, viewsets
>>> from users import views as users_view
>>> from django.contrib.auth import views as auth_views
>>> from news import views as news_views
>>> from news.models import Writer, News
>>> from news.serializers import UserSerializer, NewsSerializer
>>>
>>> urlpatterns = [
>>>path('',include('news.urls', namespace="news")),
>>>path('admin/', admin.site.urls),
>>>path('register/', users_view.register, name='register'),
>>>path('profile/', users_view.profile, name='profile'),
>>>path('login/', auth_views.LoginView.as_view(template_name=
>>> 'users/login.html'), name='login'),
>>>path('logout/', auth_views.LogoutView.as_view(template_name=
>>> 'users/logout.html'), name='logout'),
>>>path('password-reset/',
>>> auth_views.PasswordResetView.as_view(
>>>template_name='users/password_reset.html',
>>>subject_template_name='users/password_reset_subject.txt',
>>>success_url=reverse_lazy('users:password_reset_done')
>>> ),
>>> name='password_reset'),
>>>
>>> path('password-reset/done/',
>>> auth_views.PasswordResetDoneView.as_view(
>>> template_name='users/password_reset_done.html'
>>> ),
>>> name='password_reset_done'),
>>>
>>> path('password-reset-confirm///',
>>>auth_views.PasswordResetConfirmView.as_view(
>>>template_name='users/password_reset_confirm.html'
>>>),
>>>name='password_reset_confirm'),
>>>
>>>  path('password-reset-complete/',
>>> auth_views.PasswordResetCompleteView.as_view(
>>> template_name='users/password_reset_complete.html'
>>> ),
>>> name='password_reset_complete'),
>>>
>>> path('api/', include(router.urls)),
>>>path('api-auth/', include('rest_framework.urls', namespace=
>>> 'rest_framework')),
>>>path('/tinymce/', include('tinymce.urls')),
>>>
>>> ]
>>>
>>> if settings.DEBUG:
>>>urlpatterns += static(settings.MEDIA_URL, document_root=settings.
>>> MEDIA_ROOT)
>>>
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/561c6b97-6428-4af2-a1dc-09af93387b77%40googlegroups.com
>>> 
>>> .
>>>
>>
>> I attempted to create an account and log in, and it worked for me! Your
>> urls don't have a path to password_reset in the url.  That's the usual
>> culprit for that exception to be raised.
>>
>> -Jorge
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/697c8672-d832-4899-998e-f6d4d6eb8779%40googlegroups.com
> 
> .
>

By chance did you set LOGIN_REDIRECT_URL in settings.py?

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9sWK%3D5jAd8eh5n0r7eRP%2BzFMG-RKxcZPUOONyKzE4e8g%40mail.gmail.com.


Re: how h can use DICOM files through Django app?

2020-01-31 Thread Jorge Gimeno
Django forms do support file uploads.  The FileField form field
documentation is here:
https://docs.djangoproject.com/en/3.0/ref/forms/fields/#filefield

-Jorge

On Fri, Jan 31, 2020 at 5:35 PM Abdullah Shaker <
abdullah.shaker2...@gmail.com> wrote:

> i am tring to make a form through Django.
> how can i use DICOM file ?
> i have a form and i want to upload DICOM file but Django does not support
> file field in form
> so how can i use DICOM ?
> is there is a way or library ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f80368c1-face-4882-a643-17cef031c1c6%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_%3DWZSn%2B_nkAd4ewC8iiGv2YUY12Opt-O6asR4t1hO73g%40mail.gmail.com.


Re: post list view not found NoReverseMatch

2020-01-29 Thread Jorge Gimeno
This exception gives us information in the traceback about how to find what
went wrong. Without that, we can't speculate as to what is going on.  There
is a good answer here on working through NoReverseMatch exceptions:
https://stackoverflow.com/questions/38390177/what-is-a-noreversematch-error-and-how-do-i-fix-it

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK9%2By%3DviyFT1dJGtWJk%2Be1k3xNTLtrgTdUvAwRbeBauYQw%40mail.gmail.com.


Re: Django tutorial part 2: "It’s important to add __str__() methods to your models"

2020-01-12 Thread Jorge Gimeno
Hmm.  Not doing that on mine.  It is correct that __str__() is defined in
models.Model, which your models inherit from.  I don't know why it would be
considered an error.

-Jorge

On Sun, Jan 12, 2020 at 1:56 PM Julius Lange 
wrote:

> Dear people,
>
> currently doing the django tutorial! Really enjoy it so far.
>
> I am using PyCharm, Django version 3.0.2, Python version 3.7.1.
>
> In part 2  of
> the tutorial it comes to a point i need to insert a __str__ function. I add
> it like said in the tutorial and PyCharm says "Overrides Method in model"
> already.
>
> If i keep going ignoring that, i keep getting errors.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/12005821-01f0-46bd-8869-aa77cd604ea8%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK8Z1cknONhgj%3DahT2%3D8HRAT68%2BhmODLTYBCgn7OsJKOSA%40mail.gmail.com.


Re: pip install mysqlclient not working

2020-01-03 Thread Jorge Gimeno
On Fri, Jan 3, 2020 at 5:44 AM Jimmy Lukwago 
wrote:

>
> On Wed, Jan 1, 2020, 15:59 Mohd Akram  wrote:
>
>> i am using python 3.8 and django 1.11.22
>>
>> PS C:\WINDOWS\system32> *pip install mysqlclient*
>> Collecting mysqlclient
>>   Using cached
>> https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
>> Installing collected packages: mysqlclient
>> Running setup.py install for mysqlclient ... error
>> ERROR: Command errored out with exit status 1:
>>  command:
>> 'c:\users\admin\appdata\local\programs\python\python38-32\python.exe' -u -c
>> 'import sys, setuptools, tokenize; sys.argv[0] =
>> '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup.py'"'"';
>> __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup.py'"'"';f=getattr(tokenize,
>> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
>> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
>> install --record
>> 'C:\Users\Admin\AppData\Local\Temp\pip-record-gq4a004x\install-record.txt'
>> --single-version-externally-managed --compile
>>  cwd:
>> C:\Users\Admin\AppData\Local\Temp\pip-install-olk1oy74\mysqlclient\
>> Complete output (30 lines):
>> running install
>> running build
>> running build_py
>> creating build
>> creating build\lib.win32-3.8
>> creating build\lib.win32-3.8\MySQLdb
>> copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb
>> copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb
>> copying MySQLdb\compat.py -> build\lib.win32-3.8\MySQLdb
>> copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb
>> copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb
>> copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb
>> copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb
>> copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb
>> creating build\lib.win32-3.8\MySQLdb\constants
>> copying MySQLdb\constants\__init__.py ->
>> build\lib.win32-3.8\MySQLdb\constants
>> copying MySQLdb\constants\CLIENT.py ->
>> build\lib.win32-3.8\MySQLdb\constants
>> copying MySQLdb\constants\CR.py ->
>> build\lib.win32-3.8\MySQLdb\constants
>> copying MySQLdb\constants\ER.py ->
>> build\lib.win32-3.8\MySQLdb\constants
>> copying MySQLdb\constants\FIELD_TYPE.py ->
>> build\lib.win32-3.8\MySQLdb\constants
>> copying MySQLdb\constants\FLAG.py ->
>> build\lib.win32-3.8\MySQLdb\constants
>> running build_ext
>> building 'MySQLdb._mysql' extension
>> creating build\temp.win32-3.8
>> creating build\temp.win32-3.8\Release
>> creating build\temp.win32-3.8\Release\MySQLdb
>> C:\Program Files (x86)\Microsoft Visual
>> Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\cl.exe /c
>> /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0)
>> -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C
>> 6.1\include\mariadb"
>> -Ic:\users\admin\appdata\local\programs\python\python38-32\include
>> -Ic:\users\admin\appdata\local\programs\python\python38-32\include
>> "-IC:\Program Files (x86)\Microsoft Visual
>> Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program
>> Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files
>> (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files
>> (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files
>> (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files
>> (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files
>> (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /TcMySQLdb/_mysql.c
>> /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj /Zl
>> /D_CRT_SECURE_NO_WARNINGS
>> _mysql.c
>> MySQLdb/_mysql.c(29): *fatal error C1083: Cannot open include file:
>> 'mysql.h': No such file or directory*
>> *error: command 'C:\\Program Files (x86)\\Microsoft Visual
>> Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe'
>> failed with exit status 2*
>> 
>> ERROR: Command errored out with exit status 1:
>> 'c:\users\admin\appdata\local\programs\python\python38-32\python.exe' -u -c
>> 'import sys, setuptools, tokenize; sys.argv[0] =
>> '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup.py'"'"';
>> __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup.py'"'"';f=getattr(tokenize,
>> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
>> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
>> install --record
>> 'C:\Users\Admin\AppData\Local\Temp\pip-record-gq4a004x\install-record.txt'
>> --single-version-externally-managed --compile Check the logs for full
>> command output.
>>
>> --
>> 

Re: Install library from Github

2020-01-02 Thread Jorge Gimeno
On Thu, Jan 2, 2020 at 7:14 PM Mark Ogilvie 
wrote:

> Jorgge, In answer to  your question, I Python 3 was installed on my
> Windows 10 PC and could be launched by simply typing "python" at the C:\
> prompt of the command line.
> With Python session running, I was not able to locate pip until I ran the
> installation of Pip earlier today.
> Is it possible that pip was not installed automatically with the
> installation of Python 3?
> In any case, I installed Pip, and immediately Python warned me that it was
> not up-to-date, so I then updated it.
> With that accomplished, I was then able to gain access to the Github
> library.
> Thanks again for your suggestions. In the process of attempting one task,
> I learned many other things.
>
> On Thu, Jan 2, 2020 at 8:27 PM Jorge Gimeno  wrote:
>
>>
>>
>> On Wed, Jan 1, 2020 at 6:07 PM Mark34.59 
>> wrote:
>>
>>> Windows 10 PC with new Git installation is failing to recognize the
>>> command "pip":
>>> pip install git+https://github.com/gbozee/django- (command I typed per
>>> instructions)
>>> bash: pip: command not found (response from Git)
>>>
>>> On Wednesday, January 1, 2020 at 1:17:00 PM UTC-5, sanusi ibrahim
>>> adekunle wrote:
>>>>
>>>> Make sure Git is installed on your system. Below is a link to a
>>>> tutorial on installing Git for windows or Mac:
>>>> https://www.atlassian.com/git/tutorials/install-git
>>>>
>>>> After Git is installed on your system, try out this command :
>>>>
>>>> pip install git+ the url of the github library
>>>>
>>>> For example: pip install git+https://github.com/gbozee/django-
>>>>
>>>> On Wed, Jan 1, 2020, 00:10 krestoufer Toumas  wrote:
>>>>
>>>>> I wish everyone a happy new year.
>>>>> I want to include a Library from Github in my Django project but I
>>>>> don’t know how to do it.
>>>>> I found this tutorial on stack overflow
>>>>>
>>>>> https://stackoverflow.com/questions/16584552/how-to-state-in-requirements-txt-a-direct-github-source
>>>>>
>>>>> But this didn’t work for me can someone help me with this? is there
>>>>> any other way to do this ?
>>>>> Sincerely
>>>>> Django beginner
>>>>>
>>>>> --
>>>>> 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...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAP2fMDEessC1%2B_Z9TXocULabozjdXny%3DQG7L_%3Dv%2BeLSDeCitWw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAP2fMDEessC1%2B_Z9TXocULabozjdXny%3DQG7L_%3Dv%2BeLSDeCitWw%40mail.gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/284181f0-14a6-470d-be9c-365159b7cac0%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/284181f0-14a6-470d-be9c-365159b7cac0%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>
>> Mark,
>>
>> Try py -m pip install .  Pip isn't always on the
>> path by default on Windows, but the Py Installer should be. If you don't
>> have the Py Installer installed, how do you bring up your python REPL on
>> your system?
>>
>> -Jorgge
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/Ylq36KEfWTY/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANfN%3DK-3iHR4hAm%3Dws20Y_qktxHJwymaeeYcfDxg%3DczR93Ed%3Dg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANfN%

Re: Install library from Github

2020-01-02 Thread Jorge Gimeno
On Wed, Jan 1, 2020 at 6:07 PM Mark34.59  wrote:

> Windows 10 PC with new Git installation is failing to recognize the
> command "pip":
> pip install git+https://github.com/gbozee/django- (command I typed per
> instructions)
> bash: pip: command not found (response from Git)
>
> On Wednesday, January 1, 2020 at 1:17:00 PM UTC-5, sanusi ibrahim adekunle
> wrote:
>>
>> Make sure Git is installed on your system. Below is a link to a tutorial
>> on installing Git for windows or Mac:
>> https://www.atlassian.com/git/tutorials/install-git
>>
>> After Git is installed on your system, try out this command :
>>
>> pip install git+ the url of the github library
>>
>> For example: pip install git+https://github.com/gbozee/django-
>>
>> On Wed, Jan 1, 2020, 00:10 krestoufer Toumas  wrote:
>>
>>> I wish everyone a happy new year.
>>> I want to include a Library from Github in my Django project but I don’t
>>> know how to do it.
>>> I found this tutorial on stack overflow
>>>
>>> https://stackoverflow.com/questions/16584552/how-to-state-in-requirements-txt-a-direct-github-source
>>>
>>> But this didn’t work for me can someone help me with this? is there any
>>> other way to do this ?
>>> Sincerely
>>> Django beginner
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAP2fMDEessC1%2B_Z9TXocULabozjdXny%3DQG7L_%3Dv%2BeLSDeCitWw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/284181f0-14a6-470d-be9c-365159b7cac0%40googlegroups.com
> 
> .
>

Mark,

Try py -m pip install .  Pip isn't always on the
path by default on Windows, but the Py Installer should be. If you don't
have the Py Installer installed, how do you bring up your python REPL on
your system?

-Jorgge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-3iHR4hAm%3Dws20Y_qktxHJwymaeeYcfDxg%3DczR93Ed%3Dg%40mail.gmail.com.


Re: django.urls.exceptions.NoReverseMatch

2019-12-19 Thread Jorge Gimeno
On Wed, Dec 18, 2019, 10:20 PM Chetan Rokade 
wrote:

> Hi Friends,
> getting below error :
> "django.urls.exceptions.NoReverseMatch: Reverse for 'EditChange' not
> found. 'EditChange' is not a valid view function or pattern name."
>
> I have removed EditChange tag/string from all files in my project. 1) app
> level urls.py ,  2) views.py   3) base.html  4) app level changes.html
>
> still getting the same error. please help me.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/67cadc7f-e82e-4971-8719-124d01414803%40googlegroups.com
> 
> .
>


Would you please copy and paste the entire traceback here? It will help us
see what's going on.

-Jorge

>

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


Re: invalid syntax in mysite url

2019-12-17 Thread Jorge Gimeno
On Tue, Dec 17, 2019 at 9:09 AM MEGA NATHAN 
wrote:

> Hi.
>
> syntax error how to clear this one.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2f851282-b250-4575-830f-f74a08830a7a%40googlegroups.com
> 
> .
>

I see a missing comma in line 24...

-Jorge

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


Re: getting error '1' is not a valid UUID in django 3.0

2019-12-14 Thread Jorge Gimeno
On Sat, Dec 14, 2019 at 8:59 AM sagar ninave  wrote:

> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/05a199fc-d328-4b1e-be09-b1cb8a4a0ee1%40googlegroups.com
> 
> .
>

The exception is pretty clear here:  The string '1' is not a valid UUID
value.  Without seeing the rest of your code, it's impossible to know where
that value came from.

-Jorge

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


Re: Where to set the DATABASE_URL environment variable on Heroku

2019-12-06 Thread Jorge Gimeno
On Fri, Dec 6, 2019 at 5:40 PM Tim Johnson  wrote:

> Despite the voluminous Heroku documentation I am unable to establish
> where to initialize the DATABASE_URL that would establish credentials
> for my deployed database.
>
> Heroku's documentation uses the following example
>
> DATABASE_URL=$(heroku config:get HEROKU_POSTGRESQL_TIMS_URL -a timsapp)
>
> But I am not clear where this initialization code should live
>
> would it be in the procfile? If so, what process should I use. Release?
> Worker?
>
> OR
>
> Would it be in an .env file?
>
> Using django 2.1.5, python 3.7
>
> examples welcome :)
>
> thanks
>
> --
> Tim
> tj49.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a02698e8-e71a-5d42-728d-4c6d012bbb84%40akwebsoft.com
> .
>

I believe DATABASE_URL is set on Heroku itself as a configuration
variable.  If you provision the database in Heroku, it will be set for
you.  See here:
https://devcenter.heroku.com/articles/heroku-postgresql#provisioning-heroku-postgres

-Jorge

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


Re: class 'django.db.utils.ProgrammingError'

2019-12-05 Thread Jorge Gimeno
Cutting and pasting the entire traceback is a good start in helping us see
what is going wrong.

-Jorge

On Thu, Dec 5, 2019 at 10:43 AM Ram  wrote:

> Hi,
>
> I'm also hitting the similar error. I would like to know what causes this
> error. Basically we are reading a XML file and extracting certain fields
> and values and inserting them to Postgres dB. We are using Pythin script to
> extract such data in our DJango + Postgres dB based site. Could someone
> clarify the following
>
> 1. What causes this error and how it can be fixed?
>
> 2. Is there default functions available for XML deals/coupons/shopping
> product feeds integration in Django?
>
> Thanks in advance,
> ~Ram
>
> On Thu, Dec 5, 2019 at 6:24 AM Jyoshna Musti <
> jyoshn...@rohteksolutions.com> wrote:
>
>> Hi,
>> I'm trying to integrate data in PostgreSQL after the migration of the
>> data while running im facing with this kind of error could you help me from
>> solving this error and share me what all the cases will get this type of
>> error.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/23be3977-0514-42e8-88d7-cdde95f30448%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2oKLY6X8Gi3xPGbP13xr_kCcC7KT4dzUTqE63YaFv_Fg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_SuhxuHg1oB-QNxhsOes%2Brt6GLVe3mS%3D%2BKJ67tWih-ig%40mail.gmail.com.


Re: good day guys

2019-12-05 Thread Jorge Gimeno
By chance did you set AUTH_USER_MODEL in settings.py?  That's a requirement
if you're using a custom user model (I guessed that because your UserRole
inherits from AbstractUser). There's a good tutorial on writing a custom
user model here:  https://wsvincent.com/django-custom-user-model-tutorial/

-Jorge

On Wed, Dec 4, 2019 at 4:58 PM Tosin Ayoola  wrote:

> buenos días, gracias, sí, tengo un súper usuario creado, pero no puedo 
> ejecutar ningún comando que use manage.py
> Gracias
>
>
> On Thu, Dec 5, 2019 at 1:49 AM jose angel encinas ramos <
> encinasj.an...@gmail.com> wrote:
>
>> Buenas tardes, ya creaste un super usuario en django?,
>> creo que te hace falta correr python manage.py makemigrations
>> despues python manage.py migrate
>>
>> intenta eso
>>
>> El mié., 4 dic. 2019 a las 17:10, Tosin Ayoola ()
>> escribió:
>>
>>> halo guys, i'm working on a school management system that has multi user
>>> (student and staffs), i've created the model, views and form but i'm
>>> getting this error which i'm not familiar with. i'll b glad if anyone can
>>> help out
>>> below is the view, model, form and the err
>>>
>>> #forms
>>> class StudentSignupForm(UserCreationForm):
>>> class Meta(UserCreationForm.Meta):
>>> model = UserRole
>>> @transaction.atomic
>>> def save(self):
>>> user = super().save(commit=False)
>>> user.is_student = True
>>> if commit:
>>> user.save()
>>> return user
>>>
>>> class StaffSignupForm(UserCreationForm):
>>> class Meta(UserCreationForm.Meta):
>>> model = UserRole
>>> @transaction.atomic
>>> def save(self):
>>> user = super().save(commit=False)
>>> user.is_staff = True
>>> if commit:
>>> user.save()
>>> return user
>>>
>>>
>>> #views
>>> class StudentSignUp(CreateView):
>>> model = UserRole
>>> form_class = StudentSignupForm
>>> template_name = 'register/signup.html'
>>>
>>> def get_context_data(self, **kwargs):
>>> kwargs['user_type'] = 'student'
>>> return super().get_context_data(**kwargs)
>>> def student_valid_form(self, student_form):
>>> user = student_form.save()
>>> login(self.request, user)
>>> return redirect('students:student_index')
>>>
>>> class StaffSignup(CreateView):
>>> model = UserRole
>>> form_class = StaffSignupForm
>>> template_name = 'register/signup.html'
>>>
>>> def get_context_data(self, **kwargs):
>>> kwargs['user_type'] = 'staff'
>>> return super().get_context_data(**kwargs)
>>> def staff_valid_form(self, staff_form):
>>> user = staff_form.save()
>>> login(self.request, user)
>>> return redirect('staff:staff_index')
>>>
>>>
>>>
>>>
>>> #models
>>>
>>> class UserRole(AbstractUser):
>>> is_student = models.BooleanField(default=False)
>>> is_staff = models.BooleanField(default=False)
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAHLKn71OveFEozZ7J7b%3DGMBgtB7LvurcoOgbDEiTQXX%3DO%3D9zTw%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> José Ángel Encinas
>> Ing. Tecnologias de la informacion
>>
>>
>> Cel:  6622267620  <6622267620>
>>
>>*   Never give up...*
>>  
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAF3iVr9wFwnFA8OqUJKJWvApxXydDAKc0LVoL32o_LTBtaqTOQ%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHLKn73Bt%2BfX6%3DDL0ggcJtFFxNjzieo%2Biux_8XCj%2B0uVzJtkRw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: How can I host my application in web hosting?

2019-11-30 Thread Jorge Gimeno
Deb,

Digital Ocean will allow you to run what you can install.  If you can get
it on the server, you can use it.

Heroku and Python Anywhere do have specific services that are available.
You can check out their documentation to see what they are.

I don't know much about AWS, so that I will not be able to answer.

Hope it helps!

-Jorge

On Sat, Nov 30, 2019 at 6:01 AM Debabrata Chakraborty <
debobroto.c...@gmail.com> wrote:

> Hi everyone,
>
> I'm a beginner Django developer. So my apologies in advance for newbie
> like questions.
>
> I am building my site with *" *Django version 2.2.5 *"* and *" *SQLite
> 3.30 *" *in back-end. My question is -
>
> *#* Do services like "Heroku", "Digital Ocean", "Python Anywhere" and
> "AWS" - have limitation on *which version of Django*  or *which DBMS* I
> can use?
>
> I've seen this before with PHP/MySQL hosting where some hosting companies
> will limit which version of PHP or MySQL one can use. Is the same
> applicable to Django hosting in the above mentioned hosting platforms as
> well?
>
> I will very much grateful if you can help me out with this confusion.
>
> Best
>
> Deb
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a6ccc082-ae9d-4f67-8038-9db16008b956%40googlegroups.com
> 
> .
>

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


Re: I can't import views

2019-11-24 Thread Jorge Gimeno
Where is the views.py file located?

On Sun, Nov 24, 2019 at 10:23 AM Shrikanth M 
wrote:

> can i get solution for this?
>
> On Saturday, August 5, 2017 at 4:43:42 AM UTC+5:30, Body Abdo wrote:
>>
>> I'm trying to import view in my url in base project but i can't
>>
>>
>> File "/var/www/project/venvs/lib64/python3.6/importlib/__init__.py", line
>> 126, in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 978, in _gcd_import
>>   File "", line 961, in _find_and_load
>>   File "", line 950, in
>> _find_and_load_unlocked
>>   File "", line 655, in _load_unlocked
>>   File "", line 678, in exec_module
>>   File "", line 205, in
>> _call_with_frames_removed
>>   File "/var/www/project/tapelss/movies/movies/urls.py", line 4, in
>> 
>> from .import views
>> ImportError: cannot import name 'views'
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/04037b07-4883-4360-8c15-9bd8ef6cdce6%40googlegroups.com
> 
> .
>

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


Re: TypeError: api_view() takes from 0 to 1 positional arguments but 2 were given

2019-10-24 Thread Jorge Gimeno
It looks like the call to @api_view should be like this:

@api_view(['GET', 'POST'])

In other words, pass in a single list of the permitted HTTP methods. Docs
here: https://www.django-rest-framework.org/api-guide/views/#api_view

-Jorge

On Thu, Oct 24, 2019 at 5:01 PM chiyabgs  wrote:

> Project was working fine on macos. Now trying to host on linux.
> Getting this error on makemigrations / createsuperuser / runserver .
>
>  @api_view(['GET'], ['POST'])
> TypeError: api_view() takes from 0 to 1 positional arguments but 2 were
> given ( full trace below):
>
> Other projects with similar function based views was working fine on linux.
>
> Have no clue - no google / django community mentions.
>
>
> Any help appreciated
> Thanks
>
>
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File "/root/anaconda3/envs/py36latest/lib/python3.6/threading.py", line
> 916, in _bootstrap_inner
> self.run()
>   File "/root/anaconda3/envs/py36latest/lib/python3.6/threading.py", line
> 864, in run
> self._target(*self._args, **self._kwargs)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 54, in wrapper
> fn(*args, **kwargs)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 117, in inner_run
> self.check(display_num_errors=True)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/core/management/base.py",
> line 390, in check
> include_deployment_checks=include_deployment_checks,
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/core/management/base.py",
> line 377, in _run_checks
> return checks.run_checks(**kwargs)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/core/checks/registry.py",
> line 72, in run_checks
> new_errors = check(app_configs=app_configs)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 40, in check_url_namespaces_unique
> all_namespaces = _load_all_namespaces(resolver)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 57, in _load_all_namespaces
> url_patterns = getattr(resolver, 'url_patterns', [])
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/utils/functional.py",
> line 80, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 584, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/utils/functional.py",
> line 80, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 577, in urlconf_module
> return import_module(self.urlconf_name)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/importlib/__init__.py", line
> 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 994, in _gcd_import
>   File "", line 971, in _find_and_load
>   File "", line 955, in
> _find_and_load_unlocked
>   File "", line 665, in _load_unlocked
>   File "", line 678, in exec_module
>   File "", line 219, in
> _call_with_frames_removed
>   File "/usr//drf_api/drf_api/urls.py", line 23, in 
> re_path(r'^api/', include(XYZApp.urls')),
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/site-packages/django/urls/conf.py",
> line 34, in include
> urlconf_module = import_module(urlconf_module)
>   File
> "/root/anaconda3/envs/py36latest/lib/python3.6/importlib/__init__.py", line
> 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 994, in _gcd_import
>   File "", line 971, in _find_and_load
>   File "", line 955, in
> _find_and_load_unlocked
>   File "", line 665, in _load_unlocked
>   File "", line 678, in exec_module
>   File "", line 219, in
> _call_with_frames_removed
>   File "/usr/.drf_api/XYZApp/urls.py", line 4, in 
> from .import views
>   File ""/usr/.drf_api/XYZApp/views.py", line 161, in 
> @api_view(['GET'], ['POST'])
> TypeError: api_view() takes from 0 to 1 positional arguments but 2 were
> given
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0577b8aa-4903-4b5b-b3ed-3c0935bf1530%40googlegroups.com
> 

Re: Getting ```AttributeError: 'str' object has no attribute 'state_forwards'``` when running a migrations, Down there is the migrations file. please help

2019-10-22 Thread Jorge Gimeno
Can you post your models.py files, please?

-Jorge

On Tue, Oct 22, 2019, 6:07 PM fils-aime walnes andre <
walnesfilsa...@gmail.com> wrote:

> Merci freo
>
> Le lundi 21 octobre 2019, adonis simo  a écrit :
>
>>
>> # Generated by Django 2.2.3 on 2019-10-21 22:00
>>
>>
>>
>> from django.db import migrations, models
>>
>> import django.db.models.deletion
>>
>> import django_extensions.db.fields
>>
>>
>>
>>
>>
>> class Migration(migrations.Migration):
>>
>>
>>
>> dependencies = [
>>
>> ('restaurant_app', '0002_auto_20191017_1650'),
>>
>> ('hotel', '0001_initial'),
>>
>> ]
>>
>>
>>
>> operations = [
>>
>>
>>
>> migrations.CreateModel(
>>
>> name='Action',
>>
>> fields=[
>>
>> ('id', models.AutoField(auto_created=True, primary_key=
>> True, serialize=False, verbose_name='ID')),
>>
>> ('created', django_extensions.db.fields.
>> CreationDateTimeField(auto_now_add=True, verbose_name='created')),
>>
>> ('modified', django_extensions.db.fields.
>> ModificationDateTimeField(auto_now=True, verbose_name='modified')),
>>
>> ('name', models.CharField(max_length=100)),
>>
>> ('deleted', models.BooleanField(default=False)),
>>
>> ],
>>
>> options={
>>
>> 'ordering': ('-modified', '-created'),
>>
>> 'get_latest_by': 'modified',
>>
>> 'abstract': False,
>>
>> },
>>
>> ),
>>
>> ,
>>
>> migrations.CreateModel(
>>
>> name='TypeDeService',
>>
>> fields=[
>>
>> ('id', models.AutoField(auto_created=True, primary_key=
>> True, serialize=False, verbose_name='ID')),
>>
>> ('created', django_extensions.db.fields.
>> CreationDateTimeField(auto_now_add=True, verbose_name='created')),
>>
>> ('modified', django_extensions.db.fields.
>> ModificationDateTimeField(auto_now=True, verbose_name='modified')),
>>
>> ('nomservice', models.CharField(default='Tout les
>> services', max_length=50, verbose_name='Nom de service')),
>>
>> ('sigle', models.CharField(default='TS', max_length=50,
>> verbose_name='Sigle')),
>>
>> ('deleted', models.BooleanField(default=False,
>> verbose_name='produit effacee')),
>>
>> ],
>>
>> options={
>>
>> 'verbose_name': 'Type de service',
>>
>> },
>>
>> ),
>>
>> migrations.RemoveField(
>>
>> model_name='payementhotel',
>>
>> name='mode_payement_hotel',
>>
>> ),
>>
>> migrations.RemoveField(
>>
>> model_name='payementhotel',
>>
>> name='montant_paye',
>>
>> ),
>>
>> migrations.RemoveField(
>>
>> model_name='payementhotel',
>>
>> name='montant_restant',
>>
>> ),
>>
>> migrations.RemoveField(
>>
>> model_name='payementservice',
>>
>> name='mode_payement',
>>
>> ),
>>
>> migrations.RemoveField(
>>
>> model_name='payementservice',
>>
>> name='montant_paye',
>>
>> ),
>>
>> migrations.RemoveField(
>>
>> model_name='payementservice',
>>
>> name='montant_restant',
>>
>> ),
>>
>> migrations.RemoveField(
>>
>> model_name='taches',
>>
>> name='status',
>>
>> ),
>>
>> migrations.AddField(
>>
>> model_name='agent',
>>
>> name='deleted',
>>
>> field=models.BooleanField(default=False),
>>
>> ),
>>
>> migrations.AddField(
>>
>> model_name='agent',
>>
>> name='role',
>>
>> field=models.CharField(blank=True, max_length=100, null=True,
>> verbose_name='Role'),
>>
>> ),
>>
>> migrations.AddField(
>>
>> model_name='etages',
>>
>> name='deleted',
>>
>> field=models.BooleanField(default=False, verbose_name='produit
>> effacee'),
>>
>> ),
>>
>> migrations.AddField(
>>
>> model_name='factservice',
>>
>> name='montant_paye',
>>
>> field=models.IntegerField(default=0, verbose_name='Montant
>> payé'),
>>
>> ),
>>
>> migrations.AddField(
>>
>> model_name='factservice',
>>
>> name='montant_restant',
>>
>> field=models.IntegerField(default=0, verbose_name='Montant
>> restant'),
>>
>> ),
>>
>> migrations.AddField(
>>
>> model_name='facturationreservation',
>>
>> name='montant_paye',
>>
>> field=models.IntegerField(default=0, verbose_name='Montant
>> payé'),
>>
>> ),
>>
>> migrations.AddField(
>>
>> model_name='facturationreservation',
>>
>> name='montant_restant',
>>
>> field=models.IntegerField(default=0, 

Re: app urls

2019-10-21 Thread Jorge Gimeno
Hello,

With the information we have here it's very difficult to suggest anything.
I assume this is a web project. Are you using a framework? Which one? How
do you render the html pages? What have you tried so far?

All questions which will help us help you.

-Jorge

On Mon, Oct 21, 2019 at 6:47 PM Md Nayem Tushar 
wrote:

> how to add many html file in app urls without edit project urls? pls ans me
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6d835a65-1868-4539-b07f-ddca43c744ad%40googlegroups.com
> 
> .
>

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


Re: AttributeError: cffi library '_constant_time' has no function, constant or global variable named '__spec__'

2019-10-21 Thread Jorge Gimeno
Searches to both of your error messages suggested a mismatch in .so
objects. I would uninstall and reinstall Django and see if that helps.


-Jorge

On Sun, Oct 20, 2019 at 7:59 AM 'Abhishek Sharma' via Django users <
django-users@googlegroups.com> wrote:

> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "manage.py", line 21, in 
> main()
>   File "manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File "C:\Python35\lib\site-packages\django\core\management\__init__.py",
> line 381, in execute_from_command_line
> utility.execute()
>   File "C:\Python35\lib\site-packages\django\core\management\__init__.py",
> line 375, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "C:\Python35\lib\site-packages\django\core\management\base.py",
> line 323, in run_from_argv
> self.execute(*args, **cmd_options)
>   File
> "C:\Python35\lib\site-packages\django\core\management\commands\runserver.py",
> line 60, in execute
> super().execute(*args, **options)
>   File "C:\Python35\lib\site-packages\django\core\management\base.py",
> line 364, in execute
> output = self.handle(*args, **options)
>   File
> "C:\Python35\lib\site-packages\django\core\management\commands\runserver.py",
> line 95, in handle
> self.run(**options)
>   File
> "C:\Python35\lib\site-packages\django\core\management\commands\runserver.py",
> line 102, in run
> autoreload.run_with_reloader(self.inner_run, **options)
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 598, in run_with_reloader
> start_django(reloader, main_func, *args, **kwargs)
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 583, in start_django
> reloader.run(django_main_thread)
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 301, in run
> self.run_loop()
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 307, in run_loop
> next(ticker)
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 347, in tick
> for filepath, mtime in self.snapshot_files():
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 363, in snapshot_files
> for file in self.watched_files():
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 262, in watched_files
> yield from iter_all_python_module_files()
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 103, in iter_all_python_module_files
> return iter_modules_and_files(modules, frozenset(_error_files))
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 124, in iter_modules_and_files
> if getattr(module, '__spec__', None) is None:
> SystemError:  returned a result with an error
> set
>
>
>
> On Sunday, October 20, 2019 at 8:27:48 PM UTC+5:30, Abhishek Sharma wrote:
>>
>> I'm using Django and while run code getting below error, please help out
>> on it
>>
>> AttributeError: cffi library '_constant_time' has no function, constant
>> or global variable named '__spec__'
>>
>
>
>
> --
>
> The information in this e-mail and any attachments is confidential and may
> be legally privileged. It is intended solely for the addressee or
> addressee's. If you are not an intended recipient, please delete the
> message and any attachments and notify the sender of nondelivery. Any use
> or disclosure of the contents of either is unauthorised and may be
> unlawful. All liability for viruses is excluded to the fullest extent
> permitted by law. Any views expressed in this message are those of the
> individual sender, except where the sender states them, with requisite
> authority, to be those of the organisation.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e98263bd-05b9-4d7c-bbc7-bd1ebf9a4a83%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-%2BD8R9pDc23RXYGJoE4wVpzx23BGK48qy8rw-RFD8EtQ%40mail.gmail.com.


Re: a variable is not defined

2019-10-17 Thread Jorge Gimeno
I saw this that may be relevant:

https://stackoverflow.com/questions/7576202/how-can-i-pass-two-models-to-a-class-based-generic-view

-Jorge

On Thu, Oct 17, 2019 at 8:14 PM sotiris moustogiannis 
wrote:

> I want to make custom function because i want to take one result from 2
> different models (inner join), and i dont find a way to use 2 models in my
> listview class (generic)
>
> On Friday, October 18, 2019 at 6:03:18 AM UTC+3, sotiris moustogiannis
> wrote:
>>
>> I read that you can't use the def get_queryset into a function but only
>> in a generic class view, so maybe the def get_queryset function does not
>> run. I want to  make my own custom function and i want to find a way to get
>> self parameter in my function. Thanks a lot.
>>
>> On Friday, October 18, 2019 at 5:49:48 AM UTC+3, jlgimeno71 wrote:
>>>
>>> wd,
>>>
>>> The problem here is that when you're creating the context, the name
>>> 'result' is not defined. When the get_queryset() method returns, the result
>>> name goes out of scope.  My guess that's why you're getting a NameError.
>>>
>>> If that's not it, I would suggest cutting and pasting the traceback and
>>> showing us the actual code (with line numbers if you have them). It will
>>> help us diagnose the problem.
>>>
>>> -Jorge
>>>
>>> On Thu, Oct 17, 2019 at 7:25 PM wd  wrote:
>>>
 oh ,sorry my mistake. But I think the error is pretty clear ...

 On Fri, Oct 18, 2019 at 10:23 AM wd  wrote:

> Dude, you need to indent at the line include 'context' ... it's a
> beginners  problem...
>
> On Fri, Oct 18, 2019 at 10:14 AM sotiris moustogiannis <
> soto...@outlook.com> wrote:
>
>> I have an error: name 'result' is not defined
>>
>>
>>
>> def search(request):
>>
>> def get_queryset(self):
>> query = self.request.GET.get('q')
>> result = Shops.objects.filter(Q(city=query))
>>
>> return result
>>
>> context={
>> 'shops' : result,
>> }
>>
>> return render(request, 'booking/search.html',context)
>>
>>
>>
>>
>>
>> --
>> 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...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/543debc7-d517-4a7a-a9b8-f3fc7c7cc60d%40googlegroups.com
>> 
>> .
>>
> --
 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CABexzmhZtCXQRWB7S%3DL8S3B2rzmnbi3Raan1MFKW1asbSoShqg%40mail.gmail.com
 
 .

>>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/dcd65a19-628b-4ac9-9f60-d8d4b726d945%40googlegroups.com
> 
> .
>

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


Re: a variable is not defined

2019-10-17 Thread Jorge Gimeno
wd,

The problem here is that when you're creating the context, the name
'result' is not defined. When the get_queryset() method returns, the result
name goes out of scope.  My guess that's why you're getting a NameError.

If that's not it, I would suggest cutting and pasting the traceback and
showing us the actual code (with line numbers if you have them). It will
help us diagnose the problem.

-Jorge

On Thu, Oct 17, 2019 at 7:25 PM wd  wrote:

> oh ,sorry my mistake. But I think the error is pretty clear ...
>
> On Fri, Oct 18, 2019 at 10:23 AM wd  wrote:
>
>> Dude, you need to indent at the line include 'context' ... it's a
>> beginners  problem...
>>
>> On Fri, Oct 18, 2019 at 10:14 AM sotiris moustogiannis <
>> sotom...@outlook.com> wrote:
>>
>>> I have an error: name 'result' is not defined
>>>
>>>
>>>
>>> def search(request):
>>>
>>> def get_queryset(self):
>>> query = self.request.GET.get('q')
>>> result = Shops.objects.filter(Q(city=query))
>>>
>>> return result
>>>
>>> context={
>>> 'shops' : result,
>>> }
>>>
>>> return render(request, 'booking/search.html',context)
>>>
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/543debc7-d517-4a7a-a9b8-f3fc7c7cc60d%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABexzmhZtCXQRWB7S%3DL8S3B2rzmnbi3Raan1MFKW1asbSoShqg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_7-xzLEYw%3DR8-NF5De%3D7H79O%3D0NXUkk_u26ZmZm8-iZw%40mail.gmail.com.


Re: AttributeError

2019-10-01 Thread Jorge Gimeno
On Tue, Oct 1, 2019 at 9:24 PM yasar arafath Kajamydeen 
wrote:

> Hi ,
>
> While try to execute  it showing AttributeError, Can some one help me on
> this.
>
>
> *My views.py*
>
>
>
> from django.shortcuts import render
> from django.http import Http404
> from django.http import HttpResponse
> from .models import Question
>
>
> def index(request):
> latest_question_list=Question.objects.order_by('pub_date')[:3]
> context={'latest_question_list':latest_question_list}
> return render(request,'polls/index.html',context)
>
> def detail(request, question_id):
> try:
> question=Question.object.get(pk=question_id)
> except Question.DoesNotExist:
> raise Http404("Question does not exist")
> return render(request, 'polls/detail.html', {'question':question})
>
>
> def results(request, question_id):
> response = "You're looking at the results of question %s."
> return HttpResponse(response%question_id)
>
>
> def vote(request, question_id):
> return HttpResponse("You're voting on question %s."%question_id)
>
>
>
>
>
>
>
> *My detail.html*
>
>
>
>   {{question}}
>
>
>
>
>
>
>
>
>
> *My polls/urls.py*
>
>
>
>
> from django.urls import path
>
> from . import views
>
> urlpatterns = [
> # ex: /polls/
> path('', views.index, name='index'),
> # ex: /polls/5/
> path('/', views.detail, name='detail'),
> # ex: /polls/5/results/
> path('/results/', views.results, name='results'),
> # ex: /polls/5/vote/
> path('/vote/', views.vote, name='vote'),
>
> ]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9918df61-41fd-40bd-8ca3-79ee3be12ec3%40googlegroups.com
> 
> .
>

Can you please post the traceback?  Copy and paste, please. Without that we
won't know where the exception is raised.

-Jorge

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


Re: Django Project Server not starting when running on linux server but running on local windows desktop

2019-07-27 Thread Jorge Gimeno
On Fri, Jul 26, 2019, 8:22 PM Abhijith E  wrote:

> It's the latest version.
> Also I am using Anaconda Distribution with Python 3.5
>
> On Sat, Jul 27, 2019, 8:44 AM Jorge Gimeno  wrote:
>
>> What version of Django are you running?
>>
>> On Fri, Jul 26, 2019, 7:34 AM abhijithez  wrote:
>>
>>> Hi All,
>>>
>>> I have created a Django Project that is working fine on local desktop
>>> but when I am starting the same on linux server using python manage.py
>>> runserver it shows the following:
>>>
>>> $python manage.py runserver
>>>
>>> Watching for file changes with StatReloader
>>> Performing system checks...
>>> System check identified no issues (0 silenced).
>>> Traceback (most recent call last):
>>>   File "manage.py", line 21, in 
>>> main()
>>>   File "manage.py", line 17, in main
>>> execute_from_command_line(sys.argv)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>>>
>>>
>>>t/__init__.py", line 381, in execute_from_command_line
>>> utility.execute()
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>>>
>>>
>>>t/__init__.py", line 375, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>>>
>>>
>>>t/base.py", line 323, in run_from_argv
>>> self.execute(*args, **cmd_options)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>>>
>>>
>>>t/commands/runserver.py", line 60, in execute
>>> super().execute(*args, **options)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>>>
>>>
>>>t/base.py", line 364, in execute
>>> output = self.handle(*args, **options)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>>>
>>>
>>>t/commands/runserver.py", line 95, in handle
>>> self.run(**options)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>>>
>>>
>>>t/commands/runserver.py", line 102, in run
>>> autoreload.run_with_reloader(self.inner_run, **options)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 587, in run_with_reloader
>>> start_django(reloader, main_func, *args, **kwargs)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 572, in start_django
>>> reloader.run(django_main_thread)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 290, in run
>>> self.run_loop()
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 296, in run_loop
>>> next(ticker)
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 336, in tick
>>> for filepath, mtime in self.snapshot_files():
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 352, in snapshot_files
>>> for file in self.watched_files():
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 251, in watched_files
>>> yield from iter_all_python_module_files()
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 103, in iter_all_python_module_files
>>> return iter_modules_and_files(modules, frozenset(_error_files))
>>>   File
>>> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>>>
>>>
>>>ad.py", line 116, in i

Re: Django Project Server not starting when running on linux server but running on local windows desktop

2019-07-26 Thread Jorge Gimeno
What version of Django are you running?

On Fri, Jul 26, 2019, 7:34 AM abhijithez  wrote:

> Hi All,
>
> I have created a Django Project that is working fine on local desktop but
> when I am starting the same on linux server using python manage.py
> runserver it shows the following:
>
> $python manage.py runserver
>
> Watching for file changes with StatReloader
> Performing system checks...
> System check identified no issues (0 silenced).
> Traceback (most recent call last):
>   File "manage.py", line 21, in 
> main()
>   File "manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>
>
>t/__init__.py", line 381, in execute_from_command_line
> utility.execute()
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>
>
>t/__init__.py", line 375, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>
>
>t/base.py", line 323, in run_from_argv
> self.execute(*args, **cmd_options)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>
>
>t/commands/runserver.py", line 60, in execute
> super().execute(*args, **options)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>
>
>t/base.py", line 364, in execute
> output = self.handle(*args, **options)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>
>
>t/commands/runserver.py", line 95, in handle
> self.run(**options)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen
>
>
>t/commands/runserver.py", line 102, in run
> autoreload.run_with_reloader(self.inner_run, **options)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 587, in run_with_reloader
> start_django(reloader, main_func, *args, **kwargs)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 572, in start_django
> reloader.run(django_main_thread)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 290, in run
> self.run_loop()
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 296, in run_loop
> next(ticker)
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 336, in tick
> for filepath, mtime in self.snapshot_files():
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 352, in snapshot_files
> for file in self.watched_files():
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 251, in watched_files
> yield from iter_all_python_module_files()
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 103, in iter_all_python_module_files
> return iter_modules_and_files(modules, frozenset(_error_files))
>   File
> "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo
>
>
>ad.py", line 116, in iter_modules_and_files
> if module.__name__ == '__main__':
>   File "/home/mluser/anaconda3/lib/python3.5/site-packages/py/_apipkg.py",
> line
>
>   171, in __getattribute__
> return getattr(getmod(), name)
>   File "/home/mluser/anaconda3/lib/python3.5/site-packages/py/_error.py",
> line 4
>
>3, in __getattr__
> raise AttributeError(name)
> AttributeError: __name__
>
> What could be the issue?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b2e867f4-3d12-4a5e-b035-cabc7419e294%40googlegroups.com
> 
> .
>

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


Re: Unable to change db sqllite to mysql

2019-07-11 Thread Jorge Gimeno
On Thu, Jul 11, 2019 at 6:55 PM john samuel 
wrote:

> Hi shreeram,
>
> But the fact is that i  have changed the port number in xampp server for
> mySQL as 3307.
>
> On Thu, Jul 11, 2019 at 9:19 PM SHREERAM KULKARNI <
> shreeramvkulka...@gmail.com> wrote:
>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.mysql',
>> 'NAME': 'DB_NAME',
>> 'USER': 'DB_USER',
>> 'PASSWORD': 'DB_PASSWORD',
>> 'HOST': 'localhost',   # Or an IP Address that your DB is hosted on
>> 'PORT': '3306',
>> }}
>>
>>
>> On Fri, 12 Jul 2019, 1:45 am john samuel, 
>> wrote:
>>
>>> Hi Guys,
>>> I've done everything from installing sql,setting up of root and password
>>> till xampp server installation and setting the port number correctly with
>>> right installation of sqlclient and editing Database in setting as
>>>
>>> DATABASES = {
>>> 'default': {
>>> 'ENGINE': 'django.db.backends.mysql',
>>> 'NAME': 'Listo',
>>> 'USER':'root',
>>> 'PASSWORD':'',
>>> 'HOST':'localhost',
>>> 'PORT':'3307',
>>> 'OPTIONS':{
>>> 'init_command':"SET sql_mode='STRICT_TRANS_TABLES'",
>>> 'charset':'utf8mb4',
>>> },
>>> 'TEST': {
>>> 'CHARSET':'utf8mb4',
>>> 'COLLATION':'utf8mb4_unicode_ci',
>>> }
>>> }
>>> }
>>>
>>>
>>> But i am still getting an error...kindly help me...
>>> Traceback (most recent call last):
>>>   File "manage.py", line 21, in 
>>> main()
>>>   File "manage.py", line 17, in main
>>> execute_from_command_line(sys.argv)
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py",
>>> line 381, in execute_from_command_line
>>> utility.execute()
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py",
>>> line 357, in execute
>>> django.setup()
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\__init__.py",
>>> line 16, in setup
>>> from django.urls import set_script_prefix
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\urls\__init__.py",
>>> line 1, in 
>>> from .base import (
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\urls\base.py",
>>> line 8, in 
>>> from .exceptions import NoReverseMatch, Resolver404
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\urls\exceptions.py",
>>> line 1, in 
>>> from django.http import Http404
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\http\__init__.py",
>>> line 5, in 
>>> from django.http.response import (
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\http\response.py",
>>> line 15, in 
>>> from django.core.serializers.json import DjangoJSONEncoder
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\serializers\__init__.py",
>>> line 23, in 
>>> from django.core.serializers.base import SerializerDoesNotExist
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\serializers\base.py",
>>> line 7, in 
>>> from django.db import models
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\models\__init__.py",
>>> line 3, in 
>>> from django.db.models.aggregates import *  # NOQA
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\models\aggregates.py",
>>> line 5, in 
>>> from django.db.models.expressions import Case, Func, Star, When
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\models\expressions.py",
>>> line 8, in 
>>> from django.db.models import fields
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\models\fields\__init__.py",
>>> line 11, in 
>>> from django import forms
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\forms\__init__.py",
>>> line 6, in 
>>> from django.forms.boundfield import *  # NOQA
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\forms\boundfield.py",
>>> line 3, in 
>>> from django.forms.utils import flatatt, pretty_name
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\forms\utils.py",
>>> line 6, in 
>>> from django.utils import timezone
>>>   File
>>> "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\timezone.py",
>>> line 11, in 
>>> import pytz
>>> ValueError: source code string cannot contain null bytes
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop 

Re: invalid literal for int() with base 10: ''

2019-06-21 Thread Jorge Gimeno
Would you be able to copy and paste the stack trace here? Without that,
it's really hard to see where this exception is coming from.

-Jorge

On Fri, Jun 21, 2019 at 9:13 AM Lutalo Bbosa joseph 
wrote:

> here is my template that handles that bit, and i have as well attached
> atemplate in which its used
>
> On Fri, Jun 21, 2019 at 6:59 PM Aldian Fazrihady 
> wrote:
>
>> Does the stack trace mention a template variable name?  It looks like a
>> template variable that is expected to have integer value is not properly
>> initialized.
>>
>> Regards,
>>
>> Aldian Fazrihady
>>
>> On Fri, 21 Jun 2019, 22:42 Lutalo Bbosa joseph, 
>> wrote:
>>
>>> i as well have a models.py file for carts, and products which is
>>> attached, when i try to search for a solution on stack overflow,all
>>> solutions insist on problem with integers and strings in my code. though
>>> these were passed solutions and not too similar to this one
>>>
>>> On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph 
>>> wrote:
>>>
 on pressing remove the product is supposed to be removed from the cart,
 but it instead displays an error

 On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph 
 wrote:

> well here is apic of what am doing,
>
> On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <
> ahmedisht...@gmail.com> wrote:
>
>> Hi Lutalo,
>>
>> Could you also share the stacktrace of the error and when it happens?
>> It would help us decipher what's really going on in relation to what 
>> you're
>> trying to do.
>>
>> Best,
>> Ahmed
>>
>> On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <
>> bbos...@gmail.com> wrote:
>>
>>> hi guys, am working on an ecommerce system, which has cart as an
>>> app, but i keep on getting this error and cant move on any help, here 
>>> is my
>>> views.py ,
>>> from the commandline the error is on line 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+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%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+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAN7EoAbag_or9TPOb-KiYCmaD%2B4DDyG%2ByUfU%3DPzVRfacU09GNg%40mail.gmail.com
>> 

Re: How to proceed with my Pull request?

2019-05-12 Thread Jorge Gimeno
Mahdi,

You may be waiting for a bit.  As a general statement, package and
framework maintainers are volunteers and tend to work on their projects
around the other priorities in their lives. It's normal for a bit of a
delay in getting something accepted.  You can certainly contact the
maintainer, but I wouldn't expect a response right away.

-Jorge

On Sun, May 12, 2019 at 7:27 AM Mahdi Xareie  wrote:

> Hello everyone
>
> I'm newbie in open-source contribution and I need a little guidance.
> I've sent a pull request containing a few lines of tests to django
> repository few days ago, since nothing happened in the past three days
> I'm wondering what should I do now?did I miss something?
>
> Mahdi Xarei
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/eab2cf43-2a5c-9c91-9a81-acf092eddccd%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: problems with mysql client

2019-05-11 Thread Jorge Gimeno
Rob,

On the off chance you haven't seen it, I found a Stack Overflow question on
this:
https://stackoverflow.com/questions/25459386/mac-os-x-environmenterror-mysql-config-not-found.
Unfortunately, I don't know Mac OS all that well to offer more help than
that.

-Jorge

On Sat, May 11, 2019 at 9:04 AM Rob Gmail  wrote:

> Mac OS
>
> Rob
> 203-671-6514
> Sent from my mobile device, please excuse the typos.
>
> On May 11, 2019, at 11:42 AM, Jorge Gimeno  wrote:
>
>
>
> On Sat, May 11, 2019 at 8:16 AM Rob W  wrote:
>
>> for my django project, we are using mysql.
>>
>> no matter how i try to install it, python-mysqldb, or just pip install
>> mysqlclient, it fails.
>>
>> i've installed mysqlconnector, i've tried everything.
>>
>> any suggestions ?
>>
>>
>> Collecting mysqlclient
>>
>>   Downloading
>> https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
>> (85kB)
>>
>>  || 92kB 1.3MB/s
>>
>> ERROR: Complete output from command python setup.py egg_info:
>>
>> ERROR: /bin/sh: mysql_config: command not found
>>
>> Traceback (most recent call last):
>>
>>   File "", line 1, in 
>>
>>   File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup.py",
>> line 16, in 
>>
>> metadata, options = get_config()
>>
>>   File
>> "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", line 51, in
>> get_config
>>
>> libs = mysql_config("libs")
>>
>>   File
>> "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", line 29, in
>> mysql_config
>>
>> raise EnvironmentError("%s not found" % (_mysql_config_path,))
>>
>> OSError: mysql_config not found
>>
>> 
>>
>> ERROR: Command "python setup.py egg_info" failed with error code 1 in
>> /private/tmp/pip-install-suhqq3eh/mysqlclient/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/31f86e65-7e0a-49c7-b574-1670fba1ca18%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/31f86e65-7e0a-49c7-b574-1670fba1ca18%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> Rob,
>
> What operating system are you using?
>
> -Jorge
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANfN%3DK-vw16fWxhZYa3f8VP6t6cCi5BA%2BoNtjmof99CQWNKb-Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANfN%3DK-vw16fWxhZYa3f8VP6t6cCi5BA%2BoNtjmof99CQWNKb-Q%40mail.gmail.com?utm_medium=email_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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/E5694676-28BF-4FEB-92B8-0B5A86300438%40gmail.com
> <https://groups.google.com/d/msgid/django-users/E5694676-28BF-4FEB-92B8-0B5A86300438%40gmail.com?utm_medium=email_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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK8Bkqk8-8qFV9Wx6QGqUVK2nSCU-u67oFh7TcK63-bw5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: problems with mysql client

2019-05-11 Thread Jorge Gimeno
On Sat, May 11, 2019 at 8:16 AM Rob W  wrote:

> for my django project, we are using mysql.
>
> no matter how i try to install it, python-mysqldb, or just pip install
> mysqlclient, it fails.
>
> i've installed mysqlconnector, i've tried everything.
>
> any suggestions ?
>
>
> Collecting mysqlclient
>
>   Downloading
> https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
> (85kB)
>
>  || 92kB 1.3MB/s
>
> ERROR: Complete output from command python setup.py egg_info:
>
> ERROR: /bin/sh: mysql_config: command not found
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
>
>   File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup.py", line
> 16, in 
>
> metadata, options = get_config()
>
>   File
> "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", line 51, in
> get_config
>
> libs = mysql_config("libs")
>
>   File
> "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", line 29, in
> mysql_config
>
> raise EnvironmentError("%s not found" % (_mysql_config_path,))
>
> OSError: mysql_config not found
>
> 
>
> ERROR: Command "python setup.py egg_info" failed with error code 1 in
> /private/tmp/pip-install-suhqq3eh/mysqlclient/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/31f86e65-7e0a-49c7-b574-1670fba1ca18%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

Rob,

What operating system are you using?

-Jorge

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


Re: django-admin ...command error

2019-05-03 Thread Jorge Gimeno
This is a good case to use manage.py instead, as manage.py sets
DJANGO_SETTINGS_MODULE.  See here:
https://docs.djangoproject.com/en/2.2/ref/django-admin/.

-Jorge

On Fri, May 3, 2019 at 12:41 PM Josiah Umezurike <
pcintegral.pcintegr...@gmail.com> wrote:

> I shows that there is a setting problem properly not configured. I did
> configure the settings.py and wsgi.py
> I specified the path.
>
> I have tried with no avail to fix this problem. I will hope that some
> could assist on this one. If you have experienced this before please help.
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9dc45579-046a-4535-8a2e-4bf72a4a4691%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Must be my and and can't be my code -- tracing back a URL pattern type mismatch

2019-03-30 Thread Jorge Gimeno
On Sat, Mar 30, 2019 at 7:31 PM Josh Marshall <
joshua.r.marshall.1...@gmail.com> wrote:

> I'm helping out on a project, but am running into a paradox of a bug must
> existing in the code, but no project code is called.  Not sure how to deal
> with this one.  It looks related to URL setup and the urls.py file is
> practically identical to the examples.  Can anyone make sense of this stack
> trace?
>
>
> ```
> [anadon@goodadvicemallard project1]$ poetry run ./manage.py check
> /home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/psycopg2/__init__.py:144:
> UserWarning: The psycopg2 wheel package will be renamed from release 2.8;
> in order to keep installing from binary please use "pip install
> psycopg2-binary" instead. For details see: <
> http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
>   """)
> Auto generated 7 views for endpoints
> Traceback (most recent call last):
>   File "./manage.py", line 28, in 
> execute_from_command_line(sys.argv)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 381, in execute_from_command_line
> utility.execute()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 375, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 316, in run_from_argv
> self.execute(*args, **cmd_options)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 353, in execute
> output = self.handle(*args, **options)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/commands/check.py",
> line 65, in handle
> fail_level=getattr(checks, options['fail_level']),
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 379, in check
> include_deployment_checks=include_deployment_checks,
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 366, in _run_checks
> return checks.run_checks(**kwargs)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/registry.py",
> line 71, in run_checks
> new_errors = check(app_configs=app_configs)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 13, in check_url_config
> return check_resolver(resolver)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 397, in check
> warnings.extend(check_resolver(pattern))
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 397, in check
> warnings.extend(check_resolver(pattern))
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 397, in check
> warnings.extend(check_resolver(pattern))
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 398, in check
> return warnings or self.pattern.check()
> AttributeError: 'str' object has no attribute 'check'
>
> ```
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> 

Re: Unit-Testing Django Views

2019-03-30 Thread Jorge Gimeno
The online version of the book is pinned to Django 1.11. You may want to
check that out.

-Jorge

On Sat, Mar 30, 2019 at 4:40 AM Test Bot  wrote:

> Sorry for the bother but I finally solved it by using Django's Test Client
> and checking for status_code and template used to render the response in my
> unit-test.
>
> Regards,
> Test Bot
>
> On Sat, Mar 30, 2019 at 5:00 PM Test Bot  wrote:
>
>> I tried removing the {% csrf_token %} from my index.html But it seemed to
>> have no effect. I got the following traceback for further clarity
>>
>> *
>>   START OF TRACEBACK*
>>
>> ===
>> python superlists/manage.py test
>> Creating test database for alias 'default'...
>> System check identified no issues (0 silenced).
>> .F.
>> Destroying test database for alias 'default'...
>> ==
>> FAIL: test_index_view_returns_correct_html (lists.tests.HomePageTest)
>> --
>> Traceback (most recent call last):
>>   File "superlists/lists/tests.py", line 25, in
>> test_index_view_returns_correct_html
>> self.assertEqual(expected_html, actual_html)
>> AssertionError: '> chars]lue="UUl2QtIopzqg9Co4uPlTlSuEPP2O44aMhda056gd4[201 chars]l>\n' !=
>> '> chars]l>\n'
>>
>> --
>> Ran 3 tests in 0.005s
>>
>> FAILED (failures=1)
>>
>> Process finished with exit code 1
>>
>> ===
>> *
>>END OF TRACEBACK*
>>
>>
>> On Fri, Mar 29, 2019 at 12:58 AM Aldian Fazrihady 
>> wrote:
>>
>>> There are several things you can try:
>>> 1. Mocking csrf token functions
>>> 2. Passing the csrf token context from first HTML generation to the
>>> second HTML generation
>>> 3. Wiping out the csrf token parts from both HTML before comparing them.
>>>
>>> On Thu, 28 Mar 2019, 23:54 Simon Charette,  wrote:
>>>
 This is effectively failing because of a mechanism added in 1.10 to
 protect
 against BREACH attacks[0] by salting the CSRF token.

 I'm not aware of any way to disable this mechanism but testing against
 the
 exact HTML returned from a view seems fragile.

 I suggest you use assertContains[1] (with or without html=True) and
 assertTemplateUsed[2] instead.

 Cheers,
 Simon

 [0] https://docs.djangoproject.com/en/2.1/ref/csrf/#how-it-works
 [1]
 https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertContains
 [2]
 https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed

 Le jeudi 28 mars 2019 12:16:43 UTC-4, OnlineJudge95 a écrit :
>
> Hi people,
>
> I am following the book Test-Driven Development with Python
> 
>  by
> *Harry J.W. Perceval.* The book is using Django version 1.7 which is
> outdated as of now so I started with version 2.1.
>
> I am trying to unit test my index view. One unit-test that I have
> written is testing whether the index view returns correct HTML or not by
> comparing the input received through
> django.template.loader.render_to_string
> the unit-test fail with the following traceback
> python manage.py test
> Creating test database for alias 'default'...
> .System check identified no issues (0 silenced).
> F.
> ==
> FAIL: test_index_view_returns_correct_html (lists.tests.IndexViewTest)
> --
> Traceback (most recent call last):
>   File "tests.py", line 24, in test_index_view_returns_correct_html
> self.assertEqual(expected_html, actual_html)
> AssertionError: ' chars]lue="BJMT1b9fxuXOGugp00SDypeTYZxvlmc6KtBSYMDon[198 chars]l>\n' !=
> ' chars]l>\n'
>
> --
> Ran 3 tests in 0.006s
>
> FAILED (failures=1)
> Destroying test database for alias 'default'...
>
> Process finished with exit code 1
>
>
> It was clear that the csrf token is causing the test to fail. Is there
> any way to test it, or should it be tested? I ask this as when I changed 
> my
> Django version to 1.7, the tests were passing, even after giving the csrf
> token field in the form. I tried going through the changelogs but 1.7 is
> far behind (beginner here). Please find the code snippets, directory
> 

Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-17 Thread Jorge Gimeno
I assume that's in Windows Powershell. I think it's .\Scripts\activate.bat

I would also check to ensure that the Scripts folder exists in your current
directory.

-Jorge

On Thu, Jan 17, 2019 at 11:18 AM Django Geek Aditya 
wrote:

> Shell Output after entering command is
> PS E:\todo> . \Scripts\activate
> . : The term '\Scripts\activate' is not recognized as the name of a
> cmdlet, function, script file, or operable
> program. Check the spelling of the name, or if a path was included, verify
> that the path is correct and try again.
> At line:1 char:3
> + . \Scripts\activate
> +   ~
> + CategoryInfo  : ObjectNotFound: (\Scripts\activate:String)
> [], CommandNotFoundException
> + FullyQualifiedErrorId : CommandNotFoundException
>
> PS E:\todo>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/00a2f79a-0d62-4fd8-8cd4-cd5b9e8d1f2b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Tutorial - runserver freezes command prompt

2018-11-29 Thread Jorge Gimeno
We all were there once. Keep moving forward!

-Jorge

On Thu, Nov 29, 2018, 10:04 PM Scott Reed  Thanks again Jorge!  I'm such a noob :/  But this is a great learning
> experience.
>
> On Thursday, November 29, 2018 at 9:55:00 PM UTC-8, jlgimeno71 wrote:
>>
>>
>>
>> On Thu, Nov 29, 2018, 9:40 PM Scott Reed >
>>> Thanks for you response Jorge!  I see, that's just to check that it
>>> worked, and I'm supposed to quit the server to keep using the command
>>> prompt.
>>> Another question: I can't figure out the next step - opening the
>>> views.py file in the command prompt.
>>> I've tried navigating to the directory and entering the filename,
>>> entering the file's full path, doing both of those with 'python' and
>>> 'python.exe' before them, adding python's path (I think) to my
>>> environmental variables path in Windows.
>>> I'm stuck.
>>>
>>> Scott,
>>
>> To edit files you need a text editor of some sort. Notepad or Word are
>> not very useful. A good one I have seen people use is Mu, located at
>> https://codewith.mu. Notepad++ is another good option for Windows.
>>
>> -Jorge
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c6623559-baf7-4313-bf10-be9106850f74%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Tutorial - runserver freezes command prompt

2018-11-29 Thread Jorge Gimeno
On Thu, Nov 29, 2018, 9:40 PM Scott Reed  Thanks for you response Jorge!  I see, that's just to check that it
> worked, and I'm supposed to quit the server to keep using the command
> prompt.
> Another question: I can't figure out the next step - opening the views.py
> file in the command prompt.
> I've tried navigating to the directory and entering the filename, entering
> the file's full path, doing both of those with 'python' and 'python.exe'
> before them, adding python's path (I think) to my environmental variables
> path in Windows.
> I'm stuck.
>
> Scott,

To edit files you need a text editor of some sort. Notepad or Word are not
very useful. A good one I have seen people use is Mu, located at
https://codewith.mu. Notepad++ is another good option for Windows.

-Jorge

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


Re: Tutorial - runserver freezes command prompt

2018-11-29 Thread Jorge Gimeno
On Thu, Nov 29, 2018, 4:27 PM Scott Reed  Hi, I'm starting the Django polls tutorial.
> I've followed all the steps so far: installed Python and Django, set up
> the virtual environment, etc.
> I'm at the point where you start the Django development server by running
> 'py manage.py runserver' in the mysite directory.
> When I execute this command in the command prompt window, it runs and
> brings up the message shown in the tutorial, with a couple variations on my
> computer:
>
> Performing system checks...
>
> System check identified no issues (0 silenced).
>
> You have unapplied migrations; your app may not work properly until they are 
> applied.
> Run 'python manage.py migrate' to apply them.
>
> November 28, 2018 - 15:50:53
> Django version 2.1, using settings 'mysite.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
>
>
> Below this is a time/date stamp followed by "GET / HTTP/1.1" 200 16348
>
> At this point, my command prompt window is frozen.  There's a blinking
> cursor (with no path to its left, like usual), and it doesn't accept any
> input.  The only thing that I can do is press CTRL-C to quit the server,
> which takes me back to the directory, where I can enter commands, but then
> I've quit the server.
>
> Any ideas?
>
> As a side note - whatever I type in while the server appears frozen will
> appear once I quit with CTRL-C.
> Also, after quitting the server I tried to execute the 'py manage.py
> startapp polls' to create the polls directory.  It worked, and there is now
> a polls directory under the mysite directory, but I haven't been able to
> open views.py from the command line to complete the next step in the
> tutorial.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b497916f-70f3-4023-b110-a8da95e6c975%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

Scott,

Once you cursor disappears, your server is running and listening for
requests. Open a browser and point it at http://127.0.0.1:8000 and see what
happens!

-Jorge L. Gimeno

>

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


  1   2   >