Merge pull request #2478 from avaris/2474

Use pelican.server class in Invoke template
This commit is contained in:
Justin Mayer 2018-11-25 23:29:45 -07:00 committed by GitHub
commit 64d1a78373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)