Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107062
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | justin walters <walters.justin01@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Static files load problem Django 1.9 |
| Date | Fri, 15 Apr 2016 08:24:29 -0700 |
| Lines | 87 |
| Message-ID | <mailman.29.1460733878.6324.python-list@python.org> (permalink) |
| References | <CA+9XG=MV-kxnJFv5D8z_Gh_xWmu4CyqUoM+dHzDd3oqOmcdo5w@mail.gmail.com> <CAO1D73F=JKKp828vOEOihNtRYXFmx6wHSmHwS_tKVTVSa0OMJw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de WxzxaIHgYONtnrb2ps96TgC009+lf/KqaBMJrkwXPlwQ== |
| Return-Path | <walters.justin01@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; 'root': 0.04; 'executed': 0.07; 'subject:files': 0.09; 'python': 0.10; 'template': 0.11; '(at': 0.13; 'files.': 0.13; 'django': 0.13; '<body>': 0.16; '<div': 0.16; '<head>': 0.16; '<script': 0.16; "'/static/'": 0.16; '2016': 0.16; '404': 0.16; 'do)': 0.16; 'firebug': 0.16; 'folder.': 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; 'wrote:': 0.16; 'directory.': 0.18; "shouldn't": 0.18; 'skip:u 30': 0.18; '(in': 0.18; 'email addr:gmail.com>': 0.18; 'load': 0.20; 'subject:problem': 0.22; 'am,': 0.23; 'somewhere': 0.24; 'header :In-Reply-To:1': 0.24; 'error': 0.27; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'css': 0.27; 'host': 0.28; "skip:' 10": 0.28; 'lies': 0.29; 'server.': 0.30; 'url:mailman': 0.30; '15,': 0.30; 'folder': 0.30; 'problem': 0.33; 'url:python': 0.33; 'http': 0.33; 'open': 0.33; 'url:listinfo': 0.34; 'changing': 0.34; 'me?': 0.34; "skip:' 20": 0.34; 'server': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'project': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'beginning': 0.36; 'url:non-standard http port': 0.36; 'urls': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'setting': 0.37; 'received:209': 0.38; 'several': 0.38; 'files': 0.38; 'skip:o 20': 0.38; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'your': 0.60; 'skip:u 10': 0.61; 'course': 0.62; 'url:0': 0.63; 'afraid': 0.67; 'skip:\xc2 10': 0.67; 'special': 0.73; '<table': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=cQeblkj4vEsKn1Mp7LI2Pzpei7TuAM8O98EBwQjglX0=; b=FPEbHLtp4eIz8v6hyXTm3DcBD6FZlAtJTqYh7Yfepp0OZqeGpzUfnIYgvuhqsWE3Nl a8Dzt3HIVmbCv+zpuzjRYnQzzeB3lsOjklP34no2hq+PYehwxI95rGSVjA48Y7ezQEmT csFb4lkNY9h12hPlqlDbfbdkq0an2oVCezK7499gWfNN4ArcRAfCTgldO9E7xFWMq7xH dYGP2o0nOfIKDnA0JXZVHh9vkAo+bNp6X1nhWLINifM2wi/tdfG/ngygijAlA12TvZcG ZRuDJro4tElwrxt9Epwj1JaHszsyC/4xZCLMEnAkBlZQextuL8ZQXYs8qTYwtTVProk2 bqSQ== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=cQeblkj4vEsKn1Mp7LI2Pzpei7TuAM8O98EBwQjglX0=; b=dTId2ng3W9jz3MW+eXEdJeG0utFrRTkjIBhKuwJCuT4CjGw99nYfZj4t5ajjSzbBIy KsPw1bRJbLX73P/rZZj5uypZLa255+tOXVUZPsCNqIeTHrqCHPbcVnncocrDDD50UJCe 8R/IKEO4cJc7j7V6ULeMTGYqcRrdaUDSyxvea9wqXMj9asTUD8U+UDjUouv4MziKUqfw N46WqdPN1dtoJykGdvzBC05fymiSAQ1buVzIXrJUfGwyUfJyVX/OzCsWGSTpA1KYqMz+ 6ruRP2QxpoMYHvNWR4uWT9dlK9BQHjJ1aqTpL87mpuSs8aI58eW2rRLlExlHtGmARLyZ ge9A== |
| X-Gm-Message-State | AOPr4FWXBfYO/WeCnL3prSXdhzsrWsa3JqXvdijQv59tXZDRdelLngANYalfWvgR1HAO6PsraqjUGWQXQeu/Tw== |
| X-Received | by 10.112.60.100 with SMTP id g4mr9851279lbr.56.1460733869797; Fri, 15 Apr 2016 08:24:29 -0700 (PDT) |
| In-Reply-To | <CA+9XG=MV-kxnJFv5D8z_Gh_xWmu4CyqUoM+dHzDd3oqOmcdo5w@mail.gmail.com> |
| 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 | <CAO1D73F=JKKp828vOEOihNtRYXFmx6wHSmHwS_tKVTVSa0OMJw@mail.gmail.com> |
| X-Mailman-Original-References | <CA+9XG=MV-kxnJFv5D8z_Gh_xWmu4CyqUoM+dHzDd3oqOmcdo5w@mail.gmail.com> |
| Xref | csiph.com comp.lang.python:107062 |
Show key headers only | View raw
On Fri, Apr 15, 2016 at 5:13 AM, asimkon . <asimkostas@gmail.com> wrote:
> 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
> --
> https://mail.python.org/mailman/listinfo/python-list
>
You shouldn't need a special pattern in your urls for static files.
I think your issue lies with your STATIC_ROOT setting. It is the same as
your STATICFILES_DIRS setting.
Try changing the STATIC_ROOT setting to:
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static')
This will put the static root outside of your project folder. This may
solve your problem, and will make it easier to host static files somewhere
else on your server or in a CDN if need be.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Static files load problem Django 1.9 justin walters <walters.justin01@gmail.com> - 2016-04-15 08:24 -0700
csiph-web