forked from github/pelican
Use pelican.server class in invoke template
This commit is contained in:
parent
45c884cba5
commit
a3b256db1e
1 changed files with 3 additions and 7 deletions
|
|
@ -4,14 +4,10 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import datetime
|
import datetime
|
||||||
try:
|
|
||||||
import socketserver
|
|
||||||
except ImportError:
|
|
||||||
import SocketServer as socketserver
|
|
||||||
|
|
||||||
from invoke import task
|
from invoke import task
|
||||||
from invoke.util import cd
|
from invoke.util import cd
|
||||||
from pelican.server import ComplexHTTPRequestHandler
|
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
|
||||||
|
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
# Local path configuration (can be absolute or relative to tasks.py)
|
# Local path configuration (can be absolute or relative to tasks.py)
|
||||||
|
|
@ -61,12 +57,12 @@ def regenerate(c):
|
||||||
@task
|
@task
|
||||||
def serve(c):
|
def serve(c):
|
||||||
"""Serve site at http://localhost:8000/"""
|
"""Serve site at http://localhost:8000/"""
|
||||||
os.chdir(CONFIG['deploy_path'])
|
|
||||||
|
|
||||||
class AddressReuseTCPServer(socketserver.TCPServer):
|
class AddressReuseTCPServer(RootedHTTPServer):
|
||||||
allow_reuse_address = True
|
allow_reuse_address = True
|
||||||
|
|
||||||
server = AddressReuseTCPServer(
|
server = AddressReuseTCPServer(
|
||||||
|
CONFIG['deploy_path'],
|
||||||
('', CONFIG['port']),
|
('', CONFIG['port']),
|
||||||
ComplexHTTPRequestHandler)
|
ComplexHTTPRequestHandler)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue