Monday, August 31, 2020

Re: DJANGO ADMINISTRATION ERROR & TemplateDoesNotExist

The console does not seem to provide much information. It is simply stating that there is a 500 Server Error. I tried sifting for more details but there were none. 

However, in the: 

> heroku logs --tail 

It simply mentions that none of the paths exist to the cart  and the images that derive from the DJANGO ADMINISTRATION page. Strangely, all of the other pages and pictures on the website works. It is rather confusing to see only the store section of the site encountering this bug.

On Tue, Sep 1, 2020 at 12:45 AM RANGA BHARATH JINKA <bharathjinka09@gmail.com> wrote:
open console tab not elements tab

On Tue, Sep 1, 2020 at 10:13 AM King Niko <thelegendofearthreturns@gmail.com> wrote:
Interesting, the browser console states the following: 

<!doctype html>
<html lang="en">
<head>
  <title>Server Error (500)</title>
</head>
<body>
  <h1>Server Error (500)</h1><p></p>
</body>
</html>

How could the title and header 1 be causing the Server Error (500)? 

On Tue, Sep 1, 2020 at 12:39 AM RANGA BHARATH JINKA <bharathjinka09@gmail.com> wrote:
Hi,
 check in browser console for errors

On Tue, Sep 1, 2020 at 2:27 AM Lightning Bit <thelegendofearthreturns@gmail.com> wrote:
I logged into the ADMIN PORTAL and saw that there was an image for each item in the ADMIN PORTAL. 

Strangely, when returning to the website, I am unable to actually "see" the pictures - they are blank with the no file icon in the top left. This was not the case back in the testing environment.

Why would this occur only upon publishing the website? It does not seem to be registering the images from DJANGO ADMINISTRATION. Also, when I click my  cart icon after adding one of the non-image showing items, I receive an error 500 stating that the cart.html and only the cart.html TemplateDoesNotExist. It has the same settings as every other html page, what makes this single page unique to becoming an error 500? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f5e9e088-110e-4d2a-a70e-43d87bd6fdb1n%40googlegroups.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m317sPQakSxmtQVHWO8cMXWCss6F3d_FX2Gj8T-%2BELo0-Dw%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO1EWpEJbYvqaEdZ7rkd_B%2BocXjjAsbDTKZ0Aw1HxUCieqqN9w%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m315oAbkVLDFOh_DUOt5WQJg9krn9QSOv-UX2sDNeA5xBWw%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO1EWpHGiLfaZmb-E8HBWjR6cyVz2cmrqCnboKGgZtmD4VjKfA%40mail.gmail.com.

Re: DJANGO ADMINISTRATION ERROR & TemplateDoesNotExist

open console tab not elements tab

On Tue, Sep 1, 2020 at 10:13 AM King Niko <thelegendofearthreturns@gmail.com> wrote:
Interesting, the browser console states the following: 

<!doctype html>
<html lang="en">
<head>
  <title>Server Error (500)</title>
</head>
<body>
  <h1>Server Error (500)</h1><p></p>
</body>
</html>

How could the title and header 1 be causing the Server Error (500)? 

On Tue, Sep 1, 2020 at 12:39 AM RANGA BHARATH JINKA <bharathjinka09@gmail.com> wrote:
Hi,
 check in browser console for errors

On Tue, Sep 1, 2020 at 2:27 AM Lightning Bit <thelegendofearthreturns@gmail.com> wrote:
I logged into the ADMIN PORTAL and saw that there was an image for each item in the ADMIN PORTAL. 

Strangely, when returning to the website, I am unable to actually "see" the pictures - they are blank with the no file icon in the top left. This was not the case back in the testing environment.

Why would this occur only upon publishing the website? It does not seem to be registering the images from DJANGO ADMINISTRATION. Also, when I click my  cart icon after adding one of the non-image showing items, I receive an error 500 stating that the cart.html and only the cart.html TemplateDoesNotExist. It has the same settings as every other html page, what makes this single page unique to becoming an error 500? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f5e9e088-110e-4d2a-a70e-43d87bd6fdb1n%40googlegroups.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m317sPQakSxmtQVHWO8cMXWCss6F3d_FX2Gj8T-%2BELo0-Dw%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO1EWpEJbYvqaEdZ7rkd_B%2BocXjjAsbDTKZ0Aw1HxUCieqqN9w%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m315oAbkVLDFOh_DUOt5WQJg9krn9QSOv-UX2sDNeA5xBWw%40mail.gmail.com.

Re: DJANGO ADMINISTRATION ERROR & TemplateDoesNotExist

Interesting, the browser console states the following: 

<!doctype html>
<html lang="en">
<head>
  <title>Server Error (500)</title>
</head>
<body>
  <h1>Server Error (500)</h1><p></p>
</body>
</html>

How could the title and header 1 be causing the Server Error (500)? 

On Tue, Sep 1, 2020 at 12:39 AM RANGA BHARATH JINKA <bharathjinka09@gmail.com> wrote:
Hi,
 check in browser console for errors

On Tue, Sep 1, 2020 at 2:27 AM Lightning Bit <thelegendofearthreturns@gmail.com> wrote:
I logged into the ADMIN PORTAL and saw that there was an image for each item in the ADMIN PORTAL. 

Strangely, when returning to the website, I am unable to actually "see" the pictures - they are blank with the no file icon in the top left. This was not the case back in the testing environment.

Why would this occur only upon publishing the website? It does not seem to be registering the images from DJANGO ADMINISTRATION. Also, when I click my  cart icon after adding one of the non-image showing items, I receive an error 500 stating that the cart.html and only the cart.html TemplateDoesNotExist. It has the same settings as every other html page, what makes this single page unique to becoming an error 500? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f5e9e088-110e-4d2a-a70e-43d87bd6fdb1n%40googlegroups.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m317sPQakSxmtQVHWO8cMXWCss6F3d_FX2Gj8T-%2BELo0-Dw%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO1EWpEJbYvqaEdZ7rkd_B%2BocXjjAsbDTKZ0Aw1HxUCieqqN9w%40mail.gmail.com.

Re: DJANGO ADMINISTRATION ERROR & TemplateDoesNotExist

Hi,
 check in browser console for errors

On Tue, Sep 1, 2020 at 2:27 AM Lightning Bit <thelegendofearthreturns@gmail.com> wrote:
I logged into the ADMIN PORTAL and saw that there was an image for each item in the ADMIN PORTAL. 

Strangely, when returning to the website, I am unable to actually "see" the pictures - they are blank with the no file icon in the top left. This was not the case back in the testing environment.

Why would this occur only upon publishing the website? It does not seem to be registering the images from DJANGO ADMINISTRATION. Also, when I click my  cart icon after adding one of the non-image showing items, I receive an error 500 stating that the cart.html and only the cart.html TemplateDoesNotExist. It has the same settings as every other html page, what makes this single page unique to becoming an error 500? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f5e9e088-110e-4d2a-a70e-43d87bd6fdb1n%40googlegroups.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m317sPQakSxmtQVHWO8cMXWCss6F3d_FX2Gj8T-%2BELo0-Dw%40mail.gmail.com.

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

No problem.
All the best 😀

On Mon, Aug 31, 2020 at 11:35 PM Patrick Carra <pcarra.pc@gmail.com> wrote:
Thanks bharath for the info I'm going to dig more in to these.

On Friday, August 28, 2020 at 9:05:04 PM UTC-5 bharath...@gmail.com wrote:
Hi,
     
    Please check this package. This may help you. All the best

  

On Sat, 29 Aug 2020, 4:36 am Patrick Carra, <pcar...@gmail.com> wrote:
Hello All!  I need some help with a problem I have been struggling with.  One of you generous geniuses has the answer I'm sure of it.  I am working on integrating an export to csv button(link) on my template to export filtered data from one of my tables.  I have previously only been able to dump the entire table to csv which isn't exactly what I need.  So my thoughts were to place a button/link on the template passes a parameter(dictionary of my filter criteria) to a view named ExportSearch.  The view then calls a function that I have defined to perform my filtered query to the table and then writes outs to csv.  In theory I thought this should work but I keep getting errors that I have not been able to resolve and I am at the end of my knowledge capacity here.  Applicable code below.  Did I mention THANK YOU!!!!

From searchLit/urls.py
from django.urls import include, path
from . import views
from .views import search

app_name= "searchLit"

urlpatterns=[
    path('customsearch/', views.search, name='search'),
    path('customsearch/<str:params>/', views.search, name='search'),
    path('noccustomsearch/', views.nocSearch, name='nocSearch'),
    path('nocreport/export/', views.noc_export, name='noc_export'),
    path('customsearch/export/', views.searchLit_export, name='SearchLit_export'),
    path('customsearch/exportSearch/<str:params>/', views.exportSearch, name='exportSearch'),
]

From searchLit/views.py
def filterCircuits(params, search_vector):
    circuits=[]
    if(params['circuitid']==None and params['bandwidth']==None and params['region']==None and params['carrier']==None and params['status']==None and params['segmentname']==None and params['mrcnew']==None):
        circuits=Circuitinfotable.objects.all()
    else:
        if(params['multipleSearch']!=None and params['multipleSearch']!=""):
            circuits=Circuitinfotable.objects.annotate(search=search_vector).filter(search=params['multipleSearch'])
        else:
            circuits = Circuitinfotable.objects.all()
        if(params['circuitid']!=None and params['circuitid']!=""):
            circuits = Circuitinfotable.objects.all()
            circuits=circuits.filter(circuitid__icontains=params['circuitid'])
        if(params['bandwidth']!=None and params['bandwidth']!="" and params['bandwidth']!='Select Bandwidth'):
            circuits=circuits.filter(bandwidth=params['bandwidth'])
        if(params['region']!=None and params['region']!="" and params['region']!='Select Region'):
            circuits=circuits.filter(region=params['region'])
        if(params['carrier']!=None and params['carrier']!="" and params['carrier']!='Select Carrier'):
            circuits=circuits.filter(carrier=params['carrier'])
        if(params['status']!=None and params['status']!="" and params['status']!='Select Status'):
            circuits=circuits.filter(status=params['status'])
        if(params['segmentname']!=None and params['segmentname']!="" and params['segmentname']!='Select Segment'):
            circuits=circuits.filter(segmentname=params['segmentname'])
        if(params['mrcnew']!=None and params['mrcnew']!=""):
            circuits=circuits.filter(mrcnew=params['mrcnew'])
        if(params['diversity']!='Select Option'):
            if(params['diversity']=='None'):
                circuits=circuits.filter(diversity=None)
            else:
                circuits=circuits.filter(diversity__icontains=params['diversity'])
        if(params['kmz']!='Select YES/NO'):
            if(params['kmz']=='No'):
                circuits=circuits.filter(kmz=None)
            else:
                circuits=circuits.filter(kmz__isnull=False)
    return(circuits)


def search(request):
    form = CircuitForm
    template =  'customsearch/customsearch.html'
    search_vector = SearchVector('circuitid', 'carrier', 'pathname', 'segmentname', 'segmentid', 'alocationaddress', 'alocationcity', 'alocst', 'zlocationaddress', 'zlocationcity', 'zlocst', 'handoffalocaddress', 'handoffalocst',
                                 'handoffaloccity', 'handoffzlocaddress', 'handoffzloccity', 'handoffzlocst', 'latestjiraticket', 'installciopsticket', 'retermciopsticket', 'discociopsticket', 'notes', 'diversitynotes')

    params={'circuitid': request.GET.get('circuitid'),
            'bandwidth': request.GET.get('bandwidth'),
            'region': request.GET.get('region'),
            'carrier': request.GET.get('carrier'),
            'status': request.GET.get('status'),
            'segmentname': request.GET.get('segmentname'),
            'mrcnew': request.GET.get('mrcnew'),
            'diversity': request.GET.get('diversity'),
            'kmz': request.GET.get('kmz'),
            'multipleSearch': request.GET.get('multipleSearch')
           }

    context=filterCircuits(params, search_vector)
    #encoded_params = urllib.parse.urlencode(params)
    numCircuits=len(context)
    paramString = str(params)
    return render(request, template, {'form':form, 'filter':context, 'numcircuits':numCircuits, 'params':params, 'paramString': paramString})


def exportSearch(request, params):
    params = ast.literal_eval(params)
    search_vector = SearchVector('circuitid', 'carrier', 'pathname', 'segmentname', 'segmentid', 'alocationaddress', 'alocationcity', 'alocst', 'zlocationaddress', 'zlocationcity', 'zlocst', 'handoffalocaddress', 'handoffalocst',
                                 'handoffaloccity', 'handoffzlocaddress', 'handoffzloccity', 'handoffzlocst', 'latestjiraticket', 'installciopsticket', 'retermciopsticket', 'discociopsticket', 'notes', 'diversitynotes')
    allcircuits=filterCircuits(params, search_vector)
    return render_to_csv_response(allcircuits)

From template(button/link placed outside of form to capture filters called paramString)
<a href="{% url 'exportSearch' paramString %}"><input type="button" value="Self Destruct" /></a>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bbf5ec72-955d-4d52-9c43-b00d0b17551dn%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d9121985-c53c-4b10-8c68-d85e71fe95e0n%40googlegroups.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m316orLa6%2BBy8zKCRtnEGCfOU0EqChY3QAf_%3DVoOtEzww9g%40mail.gmail.com.

Re: URL configuration error for a beginner

Hello dear,

add that app in settings.py in installed apps
Eg. "base.apps.BaseAppConfig"
Or simply
"base" 

Kind regards Haris

On Tue, 1 Sep 2020, 3:59 AM Manal Helal, <manalorama@gmail.com> wrote:
Hi

I am using DJango to the first time and appreciate some explanation to the error I am receiving. I followed the steps in the polls app tutorial:


and getting the following error when running: python manage.py runserver

path('app/', include('app.urls')),

  File "/home/me/website/venv/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include

    urlconf_module = import_module(urlconf_module)

  File "/home/me/opt/python-3.8.1/lib/python3.8/importlib/__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'app.urls'


I tried adding 

from app import views


but not working and I am obviously have a long way understanding the classes and directory structure of Django and appreciate a clarification to make things easier, 


thank you in advance


Manal


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a0c75269-ad22-4860-b6bd-3b9f69b8cfd7n%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAG0UDYZtwYzMd1vJoLu-4EMP3inrJ3oE%2BXOk04q06SsLAitkFA%40mail.gmail.com.

Re: Error configuring URLs for a beginner

Do you have a urls.py in your 'app' folder? (And app is a reserved keyword, it would be better if you use some other name to avoid confusion even later )

On Tue, 1 Sep 2020 at 04:29, Manal Helal <manalorama@gmail.com> wrote:
Hi

I am using Django to the first time and followed the tutorial in:

I changes the mysite and polls app to different project and app names, and followed the instructions 

I ended up with the following error when I run python manage.py runserver:

File "/home/me/website.com/project/project/urls.py", line 21, in <module>

    path('app/', include('app.urls')),

  ...

    urlconf_module = import_module(urlconf_module)

 ...

ModuleNotFoundError: No module named 'app.urls'


app is what is created by python3 manage.py startapp app

and project is what is created by python3 venv/bin/django-admin.py startproject project


can you please explain to me how to resolve? I am trying to read through different documentation of URL resolution and tried 

from app import views

or

from app import urls


and did not work. It seems I have a long way to get used to the directory structure and naming convention and appreciate a jump start please


thank you, 


Manal

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8b13b31-3eac-4bda-88f4-559256b67eafn%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGyqUuXsBfv01e18Vey-__EhfBJ7T961p_xKUyhonDQiw2YVkw%40mail.gmail.com.

Re: URL configuration error for a beginner

You need to replace apps.url with the name of the app ( which you might have created using python manage.py startapp <appname> and have a urls.py file in that app folder)
 In the tutorial also, they first create an app 'polls' and then include 'polls.url'

It would be easier to solve your problem if you can post the directory structure here.

Regards,
Arpana

On Tue, 1 Sep 2020 at 04:29, Manal Helal <manalorama@gmail.com> wrote:
Hi

I am using DJango to the first time and appreciate some explanation to the error I am receiving. I followed the steps in the polls app tutorial:


and getting the following error when running: python manage.py runserver

path('app/', include('app.urls')),

  File "/home/me/website/venv/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include

    urlconf_module = import_module(urlconf_module)

  File "/home/me/opt/python-3.8.1/lib/python3.8/importlib/__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'app.urls'


I tried adding 

from app import views


but not working and I am obviously have a long way understanding the classes and directory structure of Django and appreciate a clarification to make things easier, 


thank you in advance


Manal


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a0c75269-ad22-4860-b6bd-3b9f69b8cfd7n%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGyqUuWCL6fBZbHbXaQGzgJo4H3av%2BSO12t6QLhyxxWx_L46gA%40mail.gmail.com.

URL configuration error for a beginner

Hi

I am using DJango to the first time and appreciate some explanation to the error I am receiving. I followed the steps in the polls app tutorial:

https://docs.djangoproject.com/en/3.1/intro/tutorial01/

and getting the following error when running: python manage.py runserver

path('app/', include('app.urls')),

  File "/home/me/website/venv/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include

    urlconf_module = import_module(urlconf_module)

  File "/home/me/opt/python-3.8.1/lib/python3.8/importlib/__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'app.urls'


I tried adding 

from app import views


but not working and I am obviously have a long way understanding the classes and directory structure of Django and appreciate a clarification to make things easier, 


thank you in advance


Manal


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

Error configuring URLs for a beginner

Hi

I am using Django to the first time and followed the tutorial in:
https://docs.djangoproject.com/en/3.1/intro/tutorial01/

I changes the mysite and polls app to different project and app names, and followed the instructions 

I ended up with the following error when I run python manage.py runserver:

File "/home/me/website.com/project/project/urls.py", line 21, in <module>

    path('app/', include('app.urls')),

  ...

    urlconf_module = import_module(urlconf_module)

 ...

ModuleNotFoundError: No module named 'app.urls'


app is what is created by python3 manage.py startapp app

and project is what is created by python3 venv/bin/django-admin.py startproject project


can you please explain to me how to resolve? I am trying to read through different documentation of URL resolution and tried 

from app import views

or

from app import urls


and did not work. It seems I have a long way to get used to the directory structure and naming convention and appreciate a jump start please


thank you, 


Manal

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8b13b31-3eac-4bda-88f4-559256b67eafn%40googlegroups.com.

DJANGO ADMINISTRATION ERROR & TemplateDoesNotExist

I logged into the ADMIN PORTAL and saw that there was an image for each item in the ADMIN PORTAL. 

Strangely, when returning to the website, I am unable to actually "see" the pictures - they are blank with the no file icon in the top left. This was not the case back in the testing environment.

Why would this occur only upon publishing the website? It does not seem to be registering the images from DJANGO ADMINISTRATION. Also, when I click my  cart icon after adding one of the non-image showing items, I receive an error 500 stating that the cart.html and only the cart.html TemplateDoesNotExist. It has the same settings as every other html page, what makes this single page unique to becoming an error 500? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f5e9e088-110e-4d2a-a70e-43d87bd6fdb1n%40googlegroups.com.

Re: unexpected change

Hi rbarhydtsf,

On 31/08/2020 20.21, rbarh...@gmail.com wrote:
> Thank you, Kasper.  Good idea.  Sadly, I don't really know how to do that.
>

I would recommend finding some tutorial on how to use git (as that is
probably what you'll use anyway). Cannot really recommend anything
specific, but someone else might be able to.

It takes some time to learn even the basics and it might seem useless as
it is time not spend on writing code, but it can save you so much time
later on, so it's definitely worth it.

Has helped me many times in frustrating situations like the one you have
right now, and you will have situations like that again, even after many
years of writing code.

We're only humans after all and most of us cannot remember the point of
the code we wrote two days ago, so it's extremely helpful to have tools
to help you remind you what you did (and why) two years ago.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/120545a5-6b6f-419f-2899-af9177bf8913%40stacktrace.dk.

Re: Premission Denied - Apache

Hi Giovanni,

On 31/08/2020 19.12, Giovanni Silva wrote:
> Dear Kasper,
>
> this is part of my code...
>

So you probably just need to ensure that the user running your Django
code has write access to BASE_DIR / media.

Now it's up to you to figure out who that user is, what that path is and
ensure the that path has the proper owner and permissions.

I personally wouldn't be afraid to add some print statements to the
deployed code for "dirty debugging" in cases like this, but that
definitely depends on you and your usecase.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0a23563c-9632-f50f-c5d6-a38a5e51d436%40stacktrace.dk.

Re: unexpected change

Thank you, Kasper.  Good idea.  Sadly, I don't really know how to do that.

On Monday, August 31, 2020 at 9:59:12 AM UTC-7 Kasper Laudrup wrote:
Hi rbarhydtsf,

On 31/08/2020 18.36, rbarh...@gmail.com wrote:
> this says that it can't find "polls/index.html" but it is there...this
> was working previously.  I don't know what changed.
>

Not that it might help you right now, but it is usually a good idea to
keep your things in revision control (e.g. git) and then commit often.
Especially when you have something that works and want to experiment
with something new.

That way you can easily see the differences between the state of the
code when it worked and the current broken state or use something like
"git bisect".

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/582d52d3-9845-4e7d-a69d-79d26c7540c4n%40googlegroups.com.

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

Thanks bharath for the info I'm going to dig more in to these.

On Friday, August 28, 2020 at 9:05:04 PM UTC-5 bharath...@gmail.com wrote:
Hi,
     
    Please check this package. This may help you. All the best

  

On Sat, 29 Aug 2020, 4:36 am Patrick Carra, <pcar...@gmail.com> wrote:
Hello All!  I need some help with a problem I have been struggling with.  One of you generous geniuses has the answer I'm sure of it.  I am working on integrating an export to csv button(link) on my template to export filtered data from one of my tables.  I have previously only been able to dump the entire table to csv which isn't exactly what I need.  So my thoughts were to place a button/link on the template passes a parameter(dictionary of my filter criteria) to a view named ExportSearch.  The view then calls a function that I have defined to perform my filtered query to the table and then writes outs to csv.  In theory I thought this should work but I keep getting errors that I have not been able to resolve and I am at the end of my knowledge capacity here.  Applicable code below.  Did I mention THANK YOU!!!!

From searchLit/urls.py
from django.urls import include, path
from . import views
from .views import search

app_name= "searchLit"

urlpatterns=[
    path('customsearch/', views.search, name='search'),
    path('customsearch/<str:params>/', views.search, name='search'),
    path('noccustomsearch/', views.nocSearch, name='nocSearch'),
    path('nocreport/export/', views.noc_export, name='noc_export'),
    path('customsearch/export/', views.searchLit_export, name='SearchLit_export'),
    path('customsearch/exportSearch/<str:params>/', views.exportSearch, name='exportSearch'),
]

From searchLit/views.py
def filterCircuits(params, search_vector):
    circuits=[]
    if(params['circuitid']==None and params['bandwidth']==None and params['region']==None and params['carrier']==None and params['status']==None and params['segmentname']==None and params['mrcnew']==None):
        circuits=Circuitinfotable.objects.all()
    else:
        if(params['multipleSearch']!=None and params['multipleSearch']!=""):
            circuits=Circuitinfotable.objects.annotate(search=search_vector).filter(search=params['multipleSearch'])
        else:
            circuits = Circuitinfotable.objects.all()
        if(params['circuitid']!=None and params['circuitid']!=""):
            circuits = Circuitinfotable.objects.all()
            circuits=circuits.filter(circuitid__icontains=params['circuitid'])
        if(params['bandwidth']!=None and params['bandwidth']!="" and params['bandwidth']!='Select Bandwidth'):
            circuits=circuits.filter(bandwidth=params['bandwidth'])
        if(params['region']!=None and params['region']!="" and params['region']!='Select Region'):
            circuits=circuits.filter(region=params['region'])
        if(params['carrier']!=None and params['carrier']!="" and params['carrier']!='Select Carrier'):
            circuits=circuits.filter(carrier=params['carrier'])
        if(params['status']!=None and params['status']!="" and params['status']!='Select Status'):
            circuits=circuits.filter(status=params['status'])
        if(params['segmentname']!=None and params['segmentname']!="" and params['segmentname']!='Select Segment'):
            circuits=circuits.filter(segmentname=params['segmentname'])
        if(params['mrcnew']!=None and params['mrcnew']!=""):
            circuits=circuits.filter(mrcnew=params['mrcnew'])
        if(params['diversity']!='Select Option'):
            if(params['diversity']=='None'):
                circuits=circuits.filter(diversity=None)
            else:
                circuits=circuits.filter(diversity__icontains=params['diversity'])
        if(params['kmz']!='Select YES/NO'):
            if(params['kmz']=='No'):
                circuits=circuits.filter(kmz=None)
            else:
                circuits=circuits.filter(kmz__isnull=False)
    return(circuits)


def search(request):
    form = CircuitForm
    template =  'customsearch/customsearch.html'
    search_vector = SearchVector('circuitid', 'carrier', 'pathname', 'segmentname', 'segmentid', 'alocationaddress', 'alocationcity', 'alocst', 'zlocationaddress', 'zlocationcity', 'zlocst', 'handoffalocaddress', 'handoffalocst',
                                 'handoffaloccity', 'handoffzlocaddress', 'handoffzloccity', 'handoffzlocst', 'latestjiraticket', 'installciopsticket', 'retermciopsticket', 'discociopsticket', 'notes', 'diversitynotes')

    params={'circuitid': request.GET.get('circuitid'),
            'bandwidth': request.GET.get('bandwidth'),
            'region': request.GET.get('region'),
            'carrier': request.GET.get('carrier'),
            'status': request.GET.get('status'),
            'segmentname': request.GET.get('segmentname'),
            'mrcnew': request.GET.get('mrcnew'),
            'diversity': request.GET.get('diversity'),
            'kmz': request.GET.get('kmz'),
            'multipleSearch': request.GET.get('multipleSearch')
           }

    context=filterCircuits(params, search_vector)
    #encoded_params = urllib.parse.urlencode(params)
    numCircuits=len(context)
    paramString = str(params)
    return render(request, template, {'form':form, 'filter':context, 'numcircuits':numCircuits, 'params':params, 'paramString': paramString})


def exportSearch(request, params):
    params = ast.literal_eval(params)
    search_vector = SearchVector('circuitid', 'carrier', 'pathname', 'segmentname', 'segmentid', 'alocationaddress', 'alocationcity', 'alocst', 'zlocationaddress', 'zlocationcity', 'zlocst', 'handoffalocaddress', 'handoffalocst',
                                 'handoffaloccity', 'handoffzlocaddress', 'handoffzloccity', 'handoffzlocst', 'latestjiraticket', 'installciopsticket', 'retermciopsticket', 'discociopsticket', 'notes', 'diversitynotes')
    allcircuits=filterCircuits(params, search_vector)
    return render_to_csv_response(allcircuits)

From template(button/link placed outside of form to capture filters called paramString)
<a href="{% url 'exportSearch' paramString %}"><input type="button" value="Self Destruct" /></a>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bbf5ec72-955d-4d52-9c43-b00d0b17551dn%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d9121985-c53c-4b10-8c68-d85e71fe95e0n%40googlegroups.com.

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

Thanks coolguy I changed my urls.py to this and that resolved the error:

from django.urls import include, path
from . import views
from .views import search

app_name= "searchLit"

urlpatterns=[
    path('customsearch/', views.search, name='search'),
    path('exportlit/', views.searchLit_export, name='SearchLit_export'),
    path('noccustomsearch/', views.nocSearch, name='nocSearch'),
    path('exportnoc/', views.noc_export, name='noc_export'),
    path('exportSearch/<str:params>/', views.exportSearch, name='exportSearch'),
]

I now am getting:

Reverse for 'exportSearch' with arguments '("{'circuitid': '', 'bandwidth': 'Select Bandwidth', 'region': 'Central', 'carrier': 'Select Carrier', 'status': 'Select Status', 'segmentname': 'Select Segment', 'mrcnew': '', 'diversity': 'Select Option', 'kmz': 'Select YES/NO', 'multipleSearch': ''}",)' not found. 1 pattern(s) tried: ['searchlit\\/exportSearch\\/(?P<params>[^/]+)\\/$']  

When I try to use this code in my template to pass a dictionary(containing my search parameters) to the export function to export only filtered table data:

template:
<a href="{% url 'searchLit:exportSearch' paramString %}"><input type="button" value="Self Destruct" /></a>


views.py:
def exportSearch(request, params):
    params = ast.literal_eval(params)
    search_vector = SearchVector('circuitid', 'carrier', 'pathname', 'segmentname', 'segmentid', 'alocationaddress', 'alocationcity', 'alocst', 'zlocationaddress', 'zlocationcity', 'zlocst', 'handoffalocaddress', 'handoffalocst',
                                 'handoffaloccity', 'handoffzlocaddress', 'handoffzloccity', 'handoffzlocst', 'latestjiraticket', 'installciopsticket', 'retermciopsticket', 'discociopsticket', 'notes', 'diversitynotes')
    allcircuits=filterCircuits(params, search_vector)
    return render_to_csv_response(allcircuits)

I assume that I need to use a different path converter but I am unsure.  Any tips am I thinking about this the right way or is there a better way to do what I am trying to do?


On Friday, August 28, 2020 at 10:28:46 PM UTC-5 coolguy wrote:
You can't have the same name twice. You need to change the name for one of the followings:
    path('customsearch/', views.search, name='search'),
    path('customsearch/<str:params>/', views.search, name='search_xxx')

Reverse method requires a url identified by name parameter which must be unique. Its looking for search and it find it on two places so you are getting this error.

On Friday, August 28, 2020 at 7:06:09 PM UTC-4 pcar...@gmail.com wrote:
Hello All!  I need some help with a problem I have been struggling with.  One of you generous geniuses has the answer I'm sure of it.  I am working on integrating an export to csv button(link) on my template to export filtered data from one of my tables.  I have previously only been able to dump the entire table to csv which isn't exactly what I need.  So my thoughts were to place a button/link on the template passes a parameter(dictionary of my filter criteria) to a view named ExportSearch.  The view then calls a function that I have defined to perform my filtered query to the table and then writes outs to csv.  In theory I thought this should work but I keep getting errors that I have not been able to resolve and I am at the end of my knowledge capacity here.  Applicable code below.  Did I mention THANK YOU!!!!

From searchLit/urls.py
from django.urls import include, path
from . import views
from .views import search

app_name= "searchLit"

urlpatterns=[
    path('customsearch/', views.search, name='search'),
    path('customsearch/<str:params>/', views.search, name='search'),
    path('noccustomsearch/', views.nocSearch, name='nocSearch'),
    path('nocreport/export/', views.noc_export, name='noc_export'),
    path('customsearch/export/', views.searchLit_export, name='SearchLit_export'),
    path('customsearch/exportSearch/<str:params>/', views.exportSearch, name='exportSearch'),
]

From searchLit/views.py
def filterCircuits(params, search_vector):
    circuits=[]
    if(params['circuitid']==None and params['bandwidth']==None and params['region']==None and params['carrier']==None and params['status']==None and params['segmentname']==None and params['mrcnew']==None):
        circuits=Circuitinfotable.objects.all()
    else:
        if(params['multipleSearch']!=None and params['multipleSearch']!=""):
            circuits=Circuitinfotable.objects.annotate(search=search_vector).filter(search=params['multipleSearch'])
        else:
            circuits = Circuitinfotable.objects.all()
        if(params['circuitid']!=None and params['circuitid']!=""):
            circuits = Circuitinfotable.objects.all()
            circuits=circuits.filter(circuitid__icontains=params['circuitid'])
        if(params['bandwidth']!=None and params['bandwidth']!="" and params['bandwidth']!='Select Bandwidth'):
            circuits=circuits.filter(bandwidth=params['bandwidth'])
        if(params['region']!=None and params['region']!="" and params['region']!='Select Region'):
            circuits=circuits.filter(region=params['region'])
        if(params['carrier']!=None and params['carrier']!="" and params['carrier']!='Select Carrier'):
            circuits=circuits.filter(carrier=params['carrier'])
        if(params['status']!=None and params['status']!="" and params['status']!='Select Status'):
            circuits=circuits.filter(status=params['status'])
        if(params['segmentname']!=None and params['segmentname']!="" and params['segmentname']!='Select Segment'):
            circuits=circuits.filter(segmentname=params['segmentname'])
        if(params['mrcnew']!=None and params['mrcnew']!=""):
            circuits=circuits.filter(mrcnew=params['mrcnew'])
        if(params['diversity']!='Select Option'):
            if(params['diversity']=='None'):
                circuits=circuits.filter(diversity=None)
            else:
                circuits=circuits.filter(diversity__icontains=params['diversity'])
        if(params['kmz']!='Select YES/NO'):
            if(params['kmz']=='No'):
                circuits=circuits.filter(kmz=None)
            else:
                circuits=circuits.filter(kmz__isnull=False)
    return(circuits)


def search(request):
    form = CircuitForm
    template =  'customsearch/customsearch.html'
    search_vector = SearchVector('circuitid', 'carrier', 'pathname', 'segmentname', 'segmentid', 'alocationaddress', 'alocationcity', 'alocst', 'zlocationaddress', 'zlocationcity', 'zlocst', 'handoffalocaddress', 'handoffalocst',
                                 'handoffaloccity', 'handoffzlocaddress', 'handoffzloccity', 'handoffzlocst', 'latestjiraticket', 'installciopsticket', 'retermciopsticket', 'discociopsticket', 'notes', 'diversitynotes')

    params={'circuitid': request.GET.get('circuitid'),
            'bandwidth': request.GET.get('bandwidth'),
            'region': request.GET.get('region'),
            'carrier': request.GET.get('carrier'),
            'status': request.GET.get('status'),
            'segmentname': request.GET.get('segmentname'),
            'mrcnew': request.GET.get('mrcnew'),
            'diversity': request.GET.get('diversity'),
            'kmz': request.GET.get('kmz'),
            'multipleSearch': request.GET.get('multipleSearch')
           }

    context=filterCircuits(params, search_vector)
    #encoded_params = urllib.parse.urlencode(params)
    numCircuits=len(context)
    paramString = str(params)
    return render(request, template, {'form':form, 'filter':context, 'numcircuits':numCircuits, 'params':params, 'paramString': paramString})


def exportSearch(request, params):
    params = ast.literal_eval(params)
    search_vector = SearchVector('circuitid', 'carrier', 'pathname', 'segmentname', 'segmentid', 'alocationaddress', 'alocationcity', 'alocst', 'zlocationaddress', 'zlocationcity', 'zlocst', 'handoffalocaddress', 'handoffalocst',
                                 'handoffaloccity', 'handoffzlocaddress', 'handoffzloccity', 'handoffzlocst', 'latestjiraticket', 'installciopsticket', 'retermciopsticket', 'discociopsticket', 'notes', 'diversitynotes')
    allcircuits=filterCircuits(params, search_vector)
    return render_to_csv_response(allcircuits)

From template(button/link placed outside of form to capture filters called paramString)
<a href="{% url 'exportSearch' paramString %}"><input type="button" value="Self Destruct" /></a>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/99d1f423-4dcc-4dd2-87c1-a3a5240e120an%40googlegroups.com.

Re: unexpected change

Found it.  Thank you.

On Monday, August 31, 2020 at 9:36:16 AM UTC-7 rbarh...@gmail.com wrote:
this says that it can't find "polls/index.html" but it is there...this was working previously.  I don't know what changed.


```
def index(request):
#return HttpResponse("I have a BIG present for you.")
latest_question_list = Question.objects.order_by('-pub_date') [:5]
#output = ','.join([q.question_text for q in latest_question_list])
template = loader.get_template('polls/index.html')
context = {'latest_question_list' : latest_question_list,

return HttpResponse("You are looking at the results of question %s."
```
this has a double folder structure so I tried stating the exact path but that didn't work either.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7371a692-a88c-4032-bbd7-9d6cc6b4dae0n%40googlegroups.com.

Re: Premission Denied - Apache

Dear Kasper, 

this is part of my code... 



Best Regards

Giovanni

Em seg., 31 de ago. de 2020 às 13:33, Kasper Laudrup <laudrup@stacktrace.dk> escreveu:
Hi Giovanni,

On 31/08/2020 18.11, Giovanni Silva wrote:
> Hi Kasper,
>
> When I was running with the django local server, I have permission and
> works good. The error occurs when I publish the site with apache2
> I gave 777 permission because I was trying to do it (give permission).
>

I understand that. My point was that not not only didn't it solve your
problem, you opened up for a lot of other potential issues later on.

As long as you don't share your code it's hard to help you much more,
but have a look at the path you specify to pdformfill in line 441 of
your views.py file and see if my suggestions might be of any help.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5846cfc6-bb53-10c2-734e-7d016b6bc72b%40stacktrace.dk.


--
Giovanni Silva
(31) 9 9532-1877

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

Re: unexpected change

here is the file structure.
```
polls
    migrations
    templates
        polls
           index.html

On Monday, August 31, 2020 at 9:36:16 AM UTC-7 rbarh...@gmail.com wrote:
this says that it can't find "polls/index.html" but it is there...this was working previously.  I don't know what changed.


```
def index(request):
#return HttpResponse("I have a BIG present for you.")
latest_question_list = Question.objects.order_by('-pub_date') [:5]
#output = ','.join([q.question_text for q in latest_question_list])
template = loader.get_template('polls/index.html')
context = {'latest_question_list' : latest_question_list,

return HttpResponse("You are looking at the results of question %s."
```
this has a double folder structure so I tried stating the exact path but that didn't work either.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/650c898f-348f-4c42-8df9-ee2858a03194n%40googlegroups.com.

Re: unexpected change

Hi rbarhydtsf,

On 31/08/2020 18.36, rbarh...@gmail.com wrote:
> this says that it can't find "polls/index.html" but it is there...this
> was working previously.  I don't know what changed.
>

Not that it might help you right now, but it is usually a good idea to
keep your things in revision control (e.g. git) and then commit often.
Especially when you have something that works and want to experiment
with something new.

That way you can easily see the differences between the state of the
code when it worked and the current broken state or use something like
"git bisect".

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bc8e60f9-98c5-076c-105a-bbb9844cf7af%40stacktrace.dk.

unexpected change

this says that it can't find "polls/index.html" but it is there...this was working previously.  I don't know what changed.


```
def index(request):
#return HttpResponse("I have a BIG present for you.")
latest_question_list = Question.objects.order_by('-pub_date') [:5]
#output = ','.join([q.question_text for q in latest_question_list])
template = loader.get_template('polls/index.html')
context = {'latest_question_list' : latest_question_list,

return HttpResponse("You are looking at the results of question %s."
```
this has a double folder structure so I tried stating the exact path but that didn't work either.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/08216e75-5825-46d8-9ecb-50569672d6dbn%40googlegroups.com.

Re: Premission Denied - Apache

Hi Giovanni,

On 31/08/2020 18.11, Giovanni Silva wrote:
> Hi Kasper,
>
> When I was running with the django local server, I have permission and
> works good. The error occurs when I publish the site with apache2
> I gave 777 permission because I was trying to do it (give permission).
>

I understand that. My point was that not not only didn't it solve your
problem, you opened up for a lot of other potential issues later on.

As long as you don't share your code it's hard to help you much more,
but have a look at the path you specify to pdformfill in line 441 of
your views.py file and see if my suggestions might be of any help.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5846cfc6-bb53-10c2-734e-7d016b6bc72b%40stacktrace.dk.

Re: Premission Denied - Apache

Hi Kasper, 

When I was running with the django local server, I have permission and works good. The error occurs when I publish the site with apache2
I gave 777 permission because I was trying to do it (give permission). 



Em seg., 31 de ago. de 2020 às 12:11, Kasper Laudrup <laudrup@stacktrace.dk> escreveu:
Hi Giovanni,

On 31/08/2020 06.00, Giovanni Silva wrote:
> Can anyone help me please?
>
> All my project folder is 777 permissions with www-data user owner and group
>

Please don't do that. That's a huge security risk and can cause all
kinds of other problems.

It is hard to know how to solve your issue since you haven't shared any
of your code, but I'd suggest you specify a base path for where you save
your PDF files in your settings.py, ensure that the user running your
django code has write access to that directory (and only that directory)
and then ensure you use that path when saving your PDF files (ie. no
relative paths).

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8e0a8790-f947-15bb-8cf4-c9c0cc59c8d8%40stacktrace.dk.


--
Giovanni Silva
(31) 9 9532-1877

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

UpdateView Redirect

I have got myself into somewhat of a pickle.

Currently I have the following url structure:
path('<uuid:pk>/', views.PublisherDetailView.as_view(), name='publisher_detail'),
path('<uuid:pk>/update/', views.PublisherUpdateView.as_view(), name='publisher_update'),

In my views the following:
class PublisherUpdateView(UpdateView):
    model = Publisher
    template_name = "catalog/publisher_update.html"
    fields = (
        "name",
        "address",
        "city",
        "state_province",
        "country",
        "website",
    )

    def get_success_url(self):
        return reverse_lazy("catalog:publisher_detail", kwargs={'pk': self.object.id})
And the link in my template is:
<a href="{% url 'catalog:publisher_update' publisher.id %}" class="btn btn-sm btn-info">Update</a>
Everything works fine at this point.
However my url structure now need to become:
path('<slug:slug>/<uuid:pk>/', views.PublisherDetailView.as_view(), name='publisher_detail'),
path(<slug:slug>/'<uuid:pk>/update/', views.PublisherUpdateView.as_view(), name='publisher_update'),

My question is how do I account for this in my views?
Any help would be appreciated

 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5f43d577-a26f-456e-a7b2-7fddabc166ccn%40googlegroups.com.

Re: Premission Denied - Apache

Hi Giovanni,

On 31/08/2020 06.00, Giovanni Silva wrote:
> Can anyone help me please?
>
> All my project folder is 777 permissions with www-data user owner and group
>

Please don't do that. That's a huge security risk and can cause all
kinds of other problems.

It is hard to know how to solve your issue since you haven't shared any
of your code, but I'd suggest you specify a base path for where you save
your PDF files in your settings.py, ensure that the user running your
django code has write access to that directory (and only that directory)
and then ensure you use that path when saving your PDF files (ie. no
relative paths).

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8e0a8790-f947-15bb-8cf4-c9c0cc59c8d8%40stacktrace.dk.

Re: can anyone help me

no whts up only insta

On Mon, 31 Aug 2020 at 14:22, sherry wilson <sherrywilson521@gmail.com> wrote:
contact on whatsapp i will clear your issues +916238639239 if its not yet cleared

On Mon, Aug 31, 2020 at 11:45 AM Deepraj Devikar <deepraj.durga@gmail.com> wrote:
yes you have to forgot upload_to  in models.py imagefield


files are
settings.py line number 135, 136
url.py line number 31
imagehadler/models.py line number 8


On Sun, Aug 30, 2020 at 10:40 AM MUGOYA DIHFAHSIH <dihfahsihm@gmail.com> wrote:
On your imagefield you forgot to add upload_to="folder_inside_your_media_folder"

On Sat, Aug 29, 2020, 19:48 allaberdi...@gmail.com <allaberdi16yazhanow@gmail.com> wrote:
I can upload images from django admin panel but cannot to do same thing with django form ,  it saves any text but did not save images only,  anyone help me  please 
this is my code:

models.py:
class Posts(models.Model):

Ahal = 'Ahal'
Balkan = 'Balkan'
Dasoguz = 'Dasoguz'
Lebap = 'Lebap'
Mary = 'Mary'


CHOOSE_REGION = {
(Ahal,'Ahal'),
(Balkan,'Balkan'),
(Dasoguz,'Dasoguz'),
(Lebap,'Lebap'),
(Mary,'Mary')


name = models.CharField(max_length=30, blank=False, verbose_name='Ady')
image = models.ImageField(blank=True, null=True, verbose_name='surat')
text = models.TextField(verbose_name='gosmaça maglumat')
price = models.FloatField(verbose_name='bahasy')
region = models.CharField(max_length=30, choices=CHOOSE_REGION, blank=False, verbose_name='welaýat')
district = models.CharField(max_length=30, blank=False, verbose_name='etrab')
user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='eýesi')
phone = models.CharField(max_length=50, blank=False, verbose_name='telefon belgisi')
published = models.DateTimeField(auto_now=True, verbose_name='satuwa çykan guni')



forms.py:
class PostForm(forms.ModelForm):
class Meta:
model = Posts
fields = ['name','image','text','price','region','district','user','phone']


views.py:
def add_post(request):
form = PostForm(request.POST or None)
if form.is_valid():
form.save()
template = 'add_post.html'
context = {'form':form}
return render(request,template,context)

settings.py:

STATIC_URL = '/static/'
STATICFILES_DIR = [Path(BASE_DIR,'static')]

MEDIA_URL = '/media/'
MEDIA_ROOT = Path(BASE_DIR,'media')


urls.py:

from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('posts.urls')),

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)



html form tag:
{% extends 'index.html' %}

{% load static %}

{% block content %}

<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{form.media}}
{{form.as_p}}
<input type="submit" value="Save" name="">
</form>

{% endblock %}

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a403ac50-9dfb-4a48-8007-9a52579886d4n%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP%3DJD9yJCOHs4bTCkhLK1meriLREBD3z%3Dd%3D8y6h9KOMAj80_yQ%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL0P1EWhxziVQECJ-ZTc%2BDCXirCWjiOjoCWDP2OPCs75GH%2B1rw%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPaR5pRYY%2B%3Dkr2qM6z0if8cjohR8%3DSQfLB5hZ8Yaf9tW%3DV%3DO%3DA%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJhs3iOQK_AsXp3xhshRfarS-44eC1QKZ-WgJ0Y%3DaS4Jao7jUA%40mail.gmail.com.