OOPs forgot to include these.
/root/tango/tango/urls.py is:
On 12/08/2015 03:59 AM, Lucas Magnum wrote:
/root/tango/tango/urls.py is:
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^rango/', include('rango.urls', namespace='rango')),
]
/root/tango/rango/urls.py is:
from django.conf.urls import patterns, url
from rango import viewsurlpatterns = patterns('',
url(r'^$', views.index, name='index'),)
rango/views.py is:
from django.shortcuts import render
def index(request):
context = {'boldmessage': "I am bold font from the context"}
return render(request, 'rango/index.html', context)
--------------------------
I hope this helps
Gary R.
On 12/08/2015 03:59 AM, Lucas Magnum wrote:
Have you changed your urls.py? https://docs.djangoproject.com/en/1.9/howto/static-files/#serving-static-files-during-development
--
[]'s
Lucas Magnum.
2015-12-07 21:45 GMT-02:00 Gary Roach <gary719_list1@verizon.net>:
While I'm working with "Tango with Django" I am using Django 1.8 and Python 3.4 (debian linux).
My project tree (somewhat truncated) is in the /root directory and looks as follows:
tango
├── bin
├── include
├── lib
└── tango
├── db.sqlite3
├── __init__.py
├── manage.py
├── rango
├── requirements.txt
├── static
│ ├── images
│ └── __init__.py
├── tango
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── __pycache__
│ ├── settings.py
│ ├── settings.pyc
│ ├── urls.py
│ └── wsgi.py
├── tango.nja
└── templates
├── __init__.py
└── rango
The pertinent parts of the settings.py file are:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
STATIC_PATH = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
STATIC_PATH,
)
The rango index.html file is:
<!DOCTYPE html>
{% load static from staticfiles %}
<html>
<head>
<title>Rango</title>
</head>
<body>
<h1>Rango says...</h1>
hello world! <strong>{{ boldmessage }}</strong><br />
<a href="/rengo/about">About</a><br />
<img src="{% static "images/apache2.png" %}" alt="Picture of Apache logo"/>
</body>
</html>
The apache2.png is just a handy image file.
The result of 127.0.0.1:8000/rango/ is:
Rango says...
hello world! I am bold font from the context
About
Picture of Apache logo
I've tried everything I can think of to try to get the image served and have totally failed. The firefox debugger just says "failed to load the given URL"
What am I doing wrong.
Gary R
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/56661A1E.30803%40verizon.net.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAB7jOxe-yN%3DVDpUc8ZzgX%2B8tw2CWf7OTTHA2svbeHm3G1sMPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment