웹페이지 url 관련 질문있습니다!


from django.conf.urls import url
from . import views

# Added 2016/02/26
from django.contrib.auth.views import login

urlpatterns = [

    url(r'^login/$', login),

    url(r'^logout/$', views.logout_page),


    # If user is not login it will redirect to login page
    url(r'^accounts/login/$', login), 

    url(r'^register/$', views.register),

    url(r'^register/success/$', views.register_success),

    url(r'^home/$', views.home),

]



{% load staticfiles %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">

<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">

        <title>Code Editor Login</title>

        <!-- <link rel="stylesheet" href="{% static 'css/login.css' %}"> -->

        <!-- CSS -->
        <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">
        <link rel="stylesheet" href="login/static/bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="login/static/font-awesome/css/font-awesome.min.css">
        <link rel="stylesheet" href="login/static/css/form-elements.css">
        <link rel="stylesheet" href="login/static/css/style.css">


        <!-- Favicon and touch icons -->
        <link rel="shortcut icon" href="/login/static/ico/favicon.png">
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="login/static/ico/apple-touch-icon-144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="login/static/ico/apple-touch-icon-114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="login/static/ico/apple-touch-icon-72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="login/static/ico/apple-touch-icon-57-precomposed.png">



    </head>
    <style>
    body {
        background-image: url('login/static/img/backgrounds/1.jpg');
    }
    </style>
    <body>
        <h1>{% block head %}{% endblock %}</h1>
        {% block content %}{% endblock %}
    </body>
</html>
{% load staticfiles %}
<!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="">

    <title>Creative - Start Bootstrap Theme</title>

    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" href="static/css/bootstrap.min.css" type="text/css">

    <!-- Custom Fonts -->
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="static/font-awesome/css/font-awesome.min.css" type="text/css">

    <!-- Plugin CSS -->
    <link rel="stylesheet" href="static/css/animate.min.css" type="text/css">

    <!-- Custom CSS -->
    <link rel="stylesheet" href="static/css/creative.css" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body id="page-top">

    <nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand page-scroll" href="#page-top">Kookmin.Univ</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a class="page-scroll" href="#about">About</a>
                    </li>
                    <li>
                        <a href='http://127.0.0.1:8000/login' class="page-scroll" href="#sign in">sign in</a>
                    </li>
                    <li>
                        <a class="page-scroll" href="#Code Edit">Code Editor</a>
                    </li>
                    <li>
                        <a class="page-scroll" href="#Chat">Chat</a>
                    </li>
                    <li>
                        <a class="page-scroll" href="#Board">Board</a>
                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>

    <header>
        <div class="header-content">
            <div class="header-content-inner">
                <h1>Of The Coding <br>By The Coding <br>For The Coding</h1>
                <hr>
                <p>코딩9조</p>
                <a href="#about" class="btn btn-primary btn-xl page-scroll">About Code Editor</a>
            </div>
        </div>
    </header>

    <section class="bg-primary" id="about">
        <div class="container">
            <div class="row">
                <div class="col-lg-8 col-lg-offset-2 text-center">
                    <h2 class="section-heading">Real time Collaborative Code Editor</h2>
                    <hr class="light">
                    <p class="text-faded">We performanced a number of programming as a compute science students.<br><br>
                    We had a variety of questions about the coding project and during a class.<br>
                    It was inconveniente to visit mento in order to solve this problem.<br><br>
                    We believe that if we have a tool which can make a feedback and collaborate among students and assistants to improve among
                    these inconveniences. <br>
                    It will create a strong synergy effect for solving this problem.
                    </p>
                    <a href="http://127.0.0.1:8000/login" class="btn btn-default btn-xl">Start Now!</a>
                </div>
            </div>
        </div>
    </section>


    <!-- jQuery -->
    <script src="static/js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="static/js/bootstrap.min.js"></script>

    <!-- Plugin JavaScript -->
    <script src="static/js/jquery.easing.min.js"></script>
    <script src="static/js/jquery.fittext.js"></script>
    <script src="static/js/wow.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="static/js/creative.js"></script>

</body>

</html>

sign in 버튼을 누르면 로그인 페이지로 이동을 하고 페이지 화면은 보여지는데 css를 읽어오지 못합니다.ㅠㅠ settings.py에서 STATIC_URL을 'static'에서 'login/static/'로 바꿔주면 홈화면의 css를 읽어오지 못합니다. 어떻게 해결해야 하는건가요... 도와주세요ㅠㅠ

  • 2016년 05월 15일에 작성됨

조회수 282


1 답변


좋아요
2
싫어요
채택취소하기
<link rel="stylesheet" href="static/css/bootstrap.min.css" type="text/css">

static URL 경로를 작성할 때 다음과 같이 변경해보세요.

<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}" type="text/css">

{% static 'STATIC_URL에 대한 상대 경로' %} 와 같이 하면 django에서 자동으로 경로를 생성해줍니다.

  • 2016년 05월 15일에 작성됨
    리눅스(유닉스) 기반의 시스템에서 웹 서비스를 개발하고 있습니다.

  • 감사합니다^^    cs   2016.5.15 21:47     

로그인이 필요한 기능입니다.

Hashcode는 개발자들을 위한 무료 QnA사이트 입니다. 작성한 답변에 다른 개발자들이 댓글을 작성하거나 좋아요/싫어요를 할 수 있기 때문에 계정을 필요로 합니다.
► 로그인
► 계정만들기
Close