0
I have an app in Django that runs in two places, one at work, which is where there is effective production, and in my house, which is where I make the adjustments because here I have time. The project is hosted in bitbucket and always use the same version of the project, both at work and at home. The design runs perfectly in both environments, with one exception... The version that runs in my house is not displaying an image that is in the /static/img/
, on my work machine is displaying normal (there runs on a debian server, with mod wsgi), and here at home runs on the same python server on linux Deepin 15.5.
Is {% load Static %} at the top of the pages displaying the image, and the path of the image is like this:
<img src="{% static 'img/brasao.jpg' %}" widt="100" height="100"/><br>
Any idea why this is happening?
py.
from django.conf.urls import url
from django.contrib import admin
from django.conf.urls import include, url
urlpatterns = [
url(r'^serf/', admin.site.urls),
#url(r'', admin.site.urls),
url(r'^jet/', include('jet.urls', 'jet')), # Django JET URLS
url(r'^i/', include('cadastro.urls')),
py. (from inside the app folder)
from django.conf.urls import include, url
from .views import EmissaoTituloDetail
from .views import LaudoImovelDetail
from .views import ImovelDetail
from .views import NotificacaoDetail
urlpatterns = [
url(r'^titulos/(?P<pk>\d+)/$', EmissaoTituloDetail.as_view(),
name='emissao_titulo_detail'),
url(r'^laudo/(?P<pk>\d+)/$', LaudoImovelDetail.as_view(),
name='laudo_imovel_detail'),
url(r'^encaminhamento/(?P<pk>\d+)/$', ImovelDetail.as_view(),
name='encaminhamento_detail'),
url(r'^notificacao/(?P<pk>\d+)/$', NotificacaoDetail.as_view(),
name='notificacao_detail'),
]
py Settings.
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
Thanks for the help friend, it didn’t work here, when I put to copy the end of the image apparently it gives the correct path (http://localhost:8000/Static/img/brasao.jpg), and the image is in /Static/img/, but the image itself is not being displayed
– Lucas Junior
In the terminal appears some 404 for that image?
– mazulo
yes, the 404 in the terminal, but the image is in the correct folder
– Lucas Junior
You can edit your question and also put your own
urls.py
and the part ofsettings.py
that has on the static archives?– mazulo
add la amigo. has two urls.py files, a general one, and one inside the app folder, because of the doubts I put both, they are like before I made the change you suggested, but I put in both what you said and it did not work
– Lucas Junior