python3 manage.py runserver
ENV :
$python3 -c "import django ; print(django.get_version())" 1.10.2
目录结构
├── audios │ ├── admin.py │ ├── apps.py │ ├── __init__.py │ ├── migrations │ ├── models.py │ ├── __pycache__ │ ├── statics │ ├── tests.py │ └── views.py ├── test │ ├── __init__.py │ ├── __pycache__ │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── static │ └── admin ├── statics │ ├── admin │ ├── css │ ├── fonts │ └── js └── templates └── index.html
settings.py
STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR,'statics') STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'audios/statics'), )
audios/views.py
from django.shortcuts import render ,render_to_response # Create your views here. def index(request): return render_to_response('index.html')
templates/index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> {% load static %} <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.css' %}"/> <script type="text/javascript" src="{% static "js/bootstrap.min.js" %}"></script> <title>Title</title> </head> <body> <div class="container container-fluid"> <table class="table"> <thead> <th>Loop Num</th> <th>Case Type</th> </thead> <tbody> </tbody> </table> </div> </body> </html>
runserver ... Done
python3 manage.py runserver 0.0.0.0:10001