Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107050

Static files load problem Django 1.9

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From "asimkon ." <asimkostas@gmail.com>
Newsgroups comp.lang.python
Subject Static files load problem Django 1.9
Date Fri, 15 Apr 2016 15:13:01 +0300
Lines 67
Message-ID <mailman.18.1460722384.6324.python-list@python.org> (permalink)
References <CA+9XG=MV-kxnJFv5D8z_Gh_xWmu4CyqUoM+dHzDd3oqOmcdo5w@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de voyOMC+9OjRXw2SY1FD+/QjqmbnWH/NBv9/PAnSz/yxQ==
Return-Path <asimkostas@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Django': 0.03; 'static': 0.03; 'executed': 0.07; 'subject:files': 0.09; 'received:209.85.218': 0.10; 'python': 0.10; 'template': 0.11; '(at': 0.13; 'django': 0.13; '&lt;div': 0.16; '&lt;script': 0.16; "'/static/'": 0.16; '404': 0.16; 'do)': 0.16; 'firebug': 0.16; 'loaded.': 0.16; 'manage.py': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'settings.py': 0.16; 'url:8000': 0.16; 'urlpatterns': 0.16; 'urls.py': 0.16; 'directory.': 0.18; 'skip:u 30': 0.18; '(in': 0.18; 'load': 0.20; 'skip:% 10': 0.22; 'subject:problem': 0.22; '8bit%:5': 0.23; 'error': 0.27; 'message- id:@mail.gmail.com': 0.27; 'css': 0.27; "skip:' 10": 0.28; 'lies': 0.29; 'server.': 0.30; 'folder': 0.30; 'problem': 0.33; 'http': 0.33; 'open': 0.33; 'me?': 0.34; "skip:' 20": 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'but': 0.36; 'project': 0.36; 'received:209.85': 0.36; 'beginning': 0.36; 'url:non-standard http port': 0.36; 'to:addr:python-list': 0.36; 'skip:& 10': 0.37; 'received:209': 0.38; 'several': 0.38; 'files': 0.38; 'skip:o 20': 0.38; 'to:addr:python.org': 0.40; 'skip:u 10': 0.61; 'course': 0.62; 'url:0': 0.63; '\xc2\xa0\xc2\xa0': 0.66; 'afraid': 0.67; 'skip:\xc2 10': 0.67; '&lt;table': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=a8a7BhfJPDAzXwRhE9J3uGhfBsbv2u9AhOYUhrLmYCc=; b=M2xChF1LfgvHglk/0qgIeO0Q7TlT4yh/XPF/Pr4GEHl4nvzeJdMG1HWqQClacpETia gzLDz7XVs2D1d5/LOLxhqf+jAXqyUgsnLTXmrwum5hcgpJx77g6w6i01rxGrf5pt0+IM 3ez7d53AjDQUwsg1ZOCzXTCkz0dHtWVKG1xUDUjRbN8PpRcIPvwEpTCQ8UfhVdJeN+Ek wt9vCXM/6MK4E5dOSn3U8iBWi5KPIh9wVlYONtiOMCf6Vt9uP0mmGInAwF0xiANsDUIl U89JhjHu+U1OAJlI9Zil/G2rbA0Oi8f7oK1p7ILa8qF+2sigCPeohUgisJoosp5bZGrZ 2UBQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=a8a7BhfJPDAzXwRhE9J3uGhfBsbv2u9AhOYUhrLmYCc=; b=lWz3J365oaxizaHTJsdWgNR7rBjDNw08oK2QMzJA8TyUcB8UQySMv+BONep3usU3Hz RYoQ4xl0MW8InoErL6qY/oDczt/4dWlcycrYDRlLdT7Cnre9nB1R6BiVCrvxxRA0PASE /8f08fTzJSkcSjeXLePPC9/49tWnuZ9mmXaecfCniw6IGekbavAFCru1G8DIbpsbRq/6 N95u9RLjJNvZ829fwcB1oaJWYUR0yJNQGg/PHu5xxobui51UBuw4s5AtAXCSYTFdBkUN Qn5AurRNhu481Jc/9Sqz7KysLMIix5BmInjHAEP8edObljHU6NXg+8bMPuMJoBbn5QWx BDbg==
X-Gm-Message-State AOPr4FVB4OGJ8aiR3WDyFf7OxGned4Y0Y5vngf7Ea5ykTqlyGFHvTbBoKruq09p/pWM+IpnZw889pn0MYrsf7A==
X-Received by 10.157.44.135 with SMTP id p7mr10749337otb.98.1460722381985; Fri, 15 Apr 2016 05:13:01 -0700 (PDT)
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CA+9XG=MV-kxnJFv5D8z_Gh_xWmu4CyqUoM+dHzDd3oqOmcdo5w@mail.gmail.com>
Xref csiph.com comp.lang.python:107050

Show key headers only | View raw


I have got a problem with static files regarding Django 1.9. These files
are (js,css)  in the standard folder static, inside project folder
directory. I got an error Http 404 that can not be loaded.

Project folder / static / css / several files *.css
                    /static / js / several files   *.js
                     several_apps

i have executed the python manage.py collectstatic

settings.py

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, "static")

STATICFILES_DIRS = (

    os.path.join(BASE_DIR, 'static'),
)

and of course  as INSTALLED_APPS

'django.contrib.staticfiles',

Sorry for my template (at the beginning of my work):

{% load  staticfiles %}

<html>
    <head>
        <link rel="stylesheet"  href="{% static 'css/jquery-ui.css' %}">
        <link rel="stylesheet"  href="{% static 'css/ui.jqgrid.css' %}">
        <script src="{% static 'js/jquery-1.11.0.min.js' %}"
type="text/javascript"> </script>
        <script src="{% static 'js/jquery.jqGrid.min.js' %}"
type="text/javascript"> </script>
        <script src="{% static 'js/grid.locale-el.js' %}"
type="text/javascript"> </script>
        <script src="{% static 'js/category.js' %}" type="text/javascript">
</script>
    </head>
    <body>

        <table id="grid"></table>
        <div id="pager"></div>

    </body>
</html>

but i am afraid the problem lies in urls.py (i do not know what to do)

http://127.0.0.1:8000/static/css/file_name  (in the firebug  network) but i
can not open it directly via server.

urls.py

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^hello/','category.views.hello'),
]


Any kind of help would be convenient to me?

Kind Regards
Kostas Asimakopoulos

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Static files load problem Django 1.9 "asimkon ." <asimkostas@gmail.com> - 2016-04-15 15:13 +0300

csiph-web