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 sys
|
||||
import datetime
|
||||
try:
|
||||
import socketserver
|
||||
except ImportError:
|
||||
import SocketServer as socketserver
|
||||
|
||||
from invoke import task
|
||||
from invoke.util import cd
|
||||
from pelican.server import ComplexHTTPRequestHandler
|
||||
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
|
||||
|
||||
CONFIG = {
|
||||
# Local path configuration (can be absolute or relative to tasks.py)
|
||||
|
|
@ -61,12 +57,12 @@ def regenerate(c):
|
|||
@task
|
||||
def serve(c):
|
||||
"""Serve site at http://localhost:8000/"""
|
||||
os.chdir(CONFIG['deploy_path'])
|
||||
|
||||
class AddressReuseTCPServer(socketserver.TCPServer):
|
||||
class AddressReuseTCPServer(RootedHTTPServer):
|
||||
allow_reuse_address = True
|
||||
|
||||
server = AddressReuseTCPServer(
|
||||
CONFIG['deploy_path'],
|
||||
('', CONFIG['port']),
|
||||
ComplexHTTPRequestHandler)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue