Hey Jeff

I tried the models that you were creating and I found out the error that 
you are having is with the Model. The upload_to of the pic variable is set 
to 'media/', which uploads the file to the url 
http://localhost:8000/oldgrub/media/media/56288852088__208FCEF9-5890-
4633-8BF6-C5C9A82D87EE.JPG. So if you change the upload_to to '', the URL 
will be http://localhost:8000/oldgrub/media/56288852088__208FCEF9-5890-
4633-8BF6-C5C9A82D87EE.JPG.

Hope this fixes the issue that you are facing.

Regards
Akash Purandare

On Sunday, November 18, 2018 at 10:57:31 PM UTC+5:30, Jeff Williams wrote:
>
> Nope.  Same error.  I can see the file being loaded.  Doesn't like the URL 
> still. 
>
> On Sun, Nov 18, 2018 at 11:30 AM Akash Purandare <akash...@gmail.com 
> <javascript:>> wrote:
>
>> Hey Jeff
>>
>> I think that you might need to upload the file again and try.
>>
>> Let me know if it works out.
>>
>> Regards
>> Akash Purandare
>>
>>
>> On Sunday, November 18, 2018 at 9:56:13 PM UTC+5:30, Jeff Williams wrote:
>>
>>> OK this is almost fixed:
>>>
>>> Why isn't this path matching?
>>>
>>> Page not found (404)
>>> Request Method: GET
>>> Request URL: 
>>> http://127.0.0.1:8000/oldgrub/media/56288852088__208FCEF9-5890-4633-8BF6-C5C9A82D87EE.JPG
>>>
>>> Using the URLconf defined in familyrecipies.urls, Django tried these 
>>> URL patterns, in this order:
>>>
>>>    1. admin/
>>>    2. oldgrub/ [name='index']
>>>    3. oldgrub/ cookbooks/ [name='cookbooks']
>>>    4. oldgrub/ cookbook/<uuid:pk> [name='cookbook']
>>>    5. oldgrub/ recipe/ [name='recipes']
>>>    6. oldgrub/ recipe/<uuid:pk> [name='recipe']
>>>    7. oldgrub/ family/ [name='family']
>>>    8. oldgrub/ recipe/add/ [name='addrecipe']
>>>    9. oldgrub/ ^oldgrub/media/(?P<path>.*)$
>>>    10. 
>>>    11. accounts/
>>>
>>> The current path, 
>>> oldgrub/media/56288852088__208FCEF9-5890-4633-8BF6-C5C9A82D87EE.JPG, 
>>> didn't match any of these.
>>>
>>> On Sun, Nov 18, 2018 at 11:08 AM Jeff Williams <jeff99w...@gmail.com> 
>>> wrote:
>>>
>> Thanks Akash.
>>>> Haven't quite fixed it yet but this is definitely the right area.  
>>>> Jeff 
>>>>
>>>> On Sun, Nov 18, 2018 at 10:52 AM Akash Purandare <akash...@gmail.com> 
>>>> wrote:
>>>>
>>> Hi Jeff
>>>>>
>>>>> I believe that the URL that you want to show is completely irrelevant 
>>>>> as the Django's FileField does that for you. However, in case you really 
>>>>> want your project name to be included in your URL, you can change the 
>>>>> MEDIA_URL in your settings.py to '/oldgrub/media' to reflect the 
>>>>> necessary 
>>>>> changes for you.
>>>>>
>>>>> Also, I believe that the problem you are facing is because you want to 
>>>>> serve your files online by using the MEDIA_URL and MEDIA_ROOT. Hence, you 
>>>>> must add this URL pattern at the end of your urls.py file of your main 
>>>>> project folder.
>>>>>
>>>>> from django.conf import settings
>>>>> from django.conf.urls.static import static
>>>>> urlpatterns = [
>>>>> ...(Your Urls)
>>>>> ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>>>>>
>>>>> Regards
>>>>> Akash Purandare
>>>>>
>>>>>
>>>>> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams 
>>>>> wrote:
>>>>>>
>>>>>> Hi All,
>>>>>> I'm new to django, so sorry if this is a newbie issue.
>>>>>>
>>>>>> I've managed to upload an ImageField....but when I try to display it 
>>>>>> in my template using object.pic.url...the URL I'm getting back is 
>>>>>> missing 
>>>>>> my project name from the URL and the pic is not loading.
>>>>>>
>>>>>> Specifically I'm getting 
>>>>>> http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>>>>  back.....and 
>>>>>> I need 
>>>>>>
>>>>>> http://127.0.0.1:8000/*oldgrub*
>>>>>> /media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>>>>
>>>>>> back to have it work.  
>>>>>>
>>>>>> What am I missing?  I've poured over my configs.
>>>>>> Jeff 
>>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Django users" group.
>>>>>
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to django-users...@googlegroups.com.
>>>>> To post to this group, send email to django...@googlegroups.com.
>>>>
>>>>
>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/django-users/ca83632a-89d5-4186-873e-8ef6bf552cc5%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/django-users/ca83632a-89d5-4186-873e-8ef6bf552cc5%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> 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/d4970488-eae4-4298-96ad-617fac29ae08%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/d4970488-eae4-4298-96ad-617fac29ae08%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/a3dd9edd-c446-4855-895f-6753de7b0a84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to