Django 1.7 has issues rendering pages on laptop

82 views
Skip to first unread message

Pitchblack

unread,
Sep 11, 2014, 3:20:03 PM9/11/14
to django...@googlegroups.com
Hello,

I have installed Debian 7, Jython 2.7b3 and Django 1.7.  After installing everything, I ran jython manage.py runserver.  If I have css files and js files referenced in the html, the pages don't render.  But the pages use to render in the older version of Django.  Does anyone have any ideas?

Collin Anderson

unread,
Sep 11, 2014, 4:16:57 PM9/11/14
to django...@googlegroups.com
Do you have DEBUG = True?

Collin Anderson

unread,
Sep 11, 2014, 4:17:29 PM9/11/14
to django...@googlegroups.com
and do you have the "staticfiles" app in your INSTALLED_APPS?

Michael Martin

unread,
Sep 11, 2014, 4:29:49 PM9/11/14
to django...@googlegroups.com
"""
Django settings for lwc project.

For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#(8-z@j1-h1hzs2a+(8p9ns(g0x3e@japhuvg!9k$bjyo4ao*e'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'doj',
    'joins',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'lwc.urls'

WSGI_APPLICATION = 'lwc.wsgi.application'


# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'doj.db.backends.postgresql',
        'NAME': 'lwc',
        'USER': 'lwc',
        'PASSWORD': 'SD!betaNEW1',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

#DATABASES = {
#    'default': {
#        'ENGINE': 'doj.db.backends.mysql',
#        'NAME': 'lwc',
#        'USER': 'root',
#        'PASSWORD': 'SD!betaNEW1',
#        'HOST': '127.0.0.1',
#        'PORT': '3306',
#   }
#}
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/
#C:\Users\michmar3\workspace\lwc
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

STATIC_URL = '/static/'

STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static")]

On Thu, Sep 11, 2014 at 9:17 AM, Collin Anderson <cmawe...@gmail.com> wrote:
and do you have the "staticfiles" app in your INSTALLED_APPS?

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5064fed6-a927-4a48-8a35-ef0534c75e2d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Michael Martin

unread,
Sep 11, 2014, 4:33:01 PM9/11/14
to django...@googlegroups.com
I just sent my settings, but as you can see I have debug turned on and django.contrib.staticfiles in the installed apps.

 Someone please help me, I can't do any development like this.

Michael Martin

unread,
Sep 11, 2014, 4:37:36 PM9/11/14
to django...@googlegroups.com
Here is an example of a template that use to work.


{% load static %}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="{% get_static_prefix %}images/logos/favicon.ico">

    <title>Launch with Code</title>

    <!-- Bootstrap core CSS -->
    <link href="{% get_static_prefix %}css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="{% get_static_prefix %}css/jumbotron.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="{% get_static_prefix %}js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="{% get_static_prefix %}js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>


    <!-- Main jumbotron for a primary marketing message or call to action -->
    <div class="jumbotron">
      <div class="container">
        <h1>Hello, world!</h1>
        <p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
        <p><a class="btn btn-primary btn-lg" role="button">Learn more &raquo;</a></p>
      </div>
    </div>

    <div class="container">
        {% block content %}
 
          {% endblock %}    
     </div>

      <hr>

      <footer>
        <p>&copy; Company 2014</p>
      </footer>
    </div> <!-- /container -->


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="{% get_static_prefix %}js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="{% get_static_prefix %}js/ie10-viewport-bug-workaround.js"></script>
  </body>
</html>
 

Collin Anderson

unread,
Sep 11, 2014, 4:38:40 PM9/11/14
to django...@googlegroups.com
What happens if you go directly to the url of one of your static files?

Also, please don't post your SECRET_KEY.

Michael A. Martin

unread,
Sep 12, 2014, 1:11:50 AM9/12/14
to django...@googlegroups.com
It seems like when I take all the CSS and JS the html renders with images. But this site rendered with a previous version. I pretty much ruined this dev project today trying to figure it out. I don't know why this worked on the older version but not this version. 

On Sep 11, 2014, at 9:38 AM, Collin Anderson <cmawe...@gmail.com> wrote:

What happens if you go directly to the url of one of your static files?

Also, please don't post your SECRET_KEY.

--
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 http://groups.google.com/group/django-users.

Lachlan Musicman

unread,
Sep 12, 2014, 1:24:49 AM9/12/14
to django...@googlegroups.com
Did you run

python manage.py collectstatic

?

cheers
L.
> https://groups.google.com/d/msgid/django-users/E521B7F1-1449-4EEF-9023-BF708E111801%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
-----------------------------------------------------------------------------------------------------------
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html

Michael Martin

unread,
Sep 12, 2014, 6:52:55 AM9/12/14
to django...@googlegroups.com
I know there has to be something wrong with either jython2.7b3 or with the django 1.7 releases.  What I did was follow someones tutorial to show where I start experiencing problems with rendering.   If do tutorials 2-5, in the middle of tutorial 5 around 6:51 in the video is where Django fails to render anything for me.  







Message has been deleted

Michael Martin

unread,
Sep 12, 2014, 7:00:39 AM9/12/14
to django...@googlegroups.com

On Thu, Sep 11, 2014 at 11:59 PM, Michael Martin <mikema...@gmail.com> wrote:
opps, I forgot the url 
com/watch?v=JZVPbHilwLI

Michael Martin

unread,
Sep 12, 2014, 3:54:30 PM9/12/14
to django...@googlegroups.com
After trying so many things regarding the settings in Django I found that the issue isn't with the official 1.7 stable release.  I found that the current official version of jython2.7b3 doesn't work with Django.  With the jython2.7b3 version I was able to start Django server, but the server is unable to render pages that use Java Script and CSS.  I would like to have this fixed and I will look for where to report the bug. 

 I did find that you can run jython2.7b2 and Django 1.7 official release together and pages will render.

James Schneider

unread,
Sep 12, 2014, 7:35:43 PM9/12/14
to django...@googlegroups.com
When you say "won't render", do you mean that a stack trace error is thrown and the server quits, or that a page comes up but your CSS/JavaScript goodies aren't applied/working?

If your problem is the latter:

Both CSS and JS are rendered client-side, so all Django is doing is creating links to your CSS and JS files in the HTML via the template code. When your page loads incorrectly, can you access the JS or CSS files directly using their respective URL's? Is the dev server showing 4XX or 5XX error codes when the browser attempts to access those files (not for the main URL, just the other ancillary static files). If so, you may need to investigate those errors before throwing in the towel. The use of a specific version of Jython is probably not relevant unless it is causing issues serving up your static files, which is a possibility.

-James



On Friday, September 12, 2014, Michael Martin <mikema...@gmail.com> wrote:
After trying so many things regarding the settings in Django I found that the issue isn't with the official 1.7 stable release.  I found that the current official version of jython2.7b3 doesn't work with Django.  With the jython2.7b3 version I was able to start Django server, but the server is unable to render pages that use Java Script and CSS.  I would like to have this fixed and I will look for where to report the bug. 

 I did find that you can run jython2.7b2 and Django 1.7 official release together and pages will render.
On Thu, Sep 11, 2014 at 11:59 PM, Michael Martin <mikema...@gmail.com> wrote:

Michael A. Martin

unread,
Sep 12, 2014, 10:12:32 PM9/12/14
to django...@googlegroups.com
The same application works fine on jython2.7b2 and Django 1.7 

I followed a tutorial step by step and it fails on a simple example.  It isn't a matter of not being able to access the CSS. 

It appears as if there is some loop issue or connection issue. I didn't try to run a debugger against it to look into it further.

I looked at the release notes of jython2.7c and I read that they did some work of sockets/select/ssl. It's possible that they added a feature and broke something else between versions.

Michael Martin

unread,
Sep 12, 2014, 10:18:14 PM9/12/14
to django...@googlegroups.com
I just looked at my ticket and it was marked as a duplicate of issue 2201.
 http://bugs.jython.org/issue2201


Reply all
Reply to author
Forward
0 new messages