mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
commit
9f0ad2bd95
3 changed files with 22 additions and 10 deletions
|
|
@ -10,7 +10,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import socketserver # NOQA
|
import socketserver # NOQA
|
||||||
|
|
||||||
PORT = 8000
|
PORT = len(sys.argv) == 2 and int(sys.argv[1]) or 8000
|
||||||
|
|
||||||
Handler = srvmod.SimpleHTTPRequestHandler
|
Handler = srvmod.SimpleHTTPRequestHandler
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ help:
|
||||||
@echo ' make clean remove the generated files '
|
@echo ' make clean remove the generated files '
|
||||||
@echo ' make regenerate regenerate files upon modification '
|
@echo ' make regenerate regenerate files upon modification '
|
||||||
@echo ' make publish generate using production settings '
|
@echo ' make publish generate using production settings '
|
||||||
@echo ' make serve serve site at http://localhost:8000'
|
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
|
||||||
@echo ' make devserver start/restart develop_server.sh '
|
@echo ' make devserver [PORT=8000] start/restart develop_server.sh '
|
||||||
@echo ' make stopserver stop local server '
|
@echo ' make stopserver stop local server '
|
||||||
@echo ' ssh_upload upload the web site via SSH '
|
@echo ' ssh_upload upload the web site via SSH '
|
||||||
@echo ' rsync_upload upload the web site via rsync+ssh '
|
@echo ' rsync_upload upload the web site via rsync+ssh '
|
||||||
|
|
@ -50,10 +50,18 @@ regenerate:
|
||||||
$$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
|
$$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
|
||||||
|
|
||||||
serve:
|
serve:
|
||||||
|
ifdef PORT
|
||||||
|
cd $$(OUTPUTDIR) && $(PY) -m pelican.server $$(PORT)
|
||||||
|
else
|
||||||
cd $$(OUTPUTDIR) && $(PY) -m pelican.server
|
cd $$(OUTPUTDIR) && $(PY) -m pelican.server
|
||||||
|
endif
|
||||||
|
|
||||||
devserver:
|
devserver:
|
||||||
|
ifdef PORT
|
||||||
|
$$(BASEDIR)/develop_server.sh restart $$(PORT)
|
||||||
|
else
|
||||||
$$(BASEDIR)/develop_server.sh restart
|
$$(BASEDIR)/develop_server.sh restart
|
||||||
|
endif
|
||||||
|
|
||||||
stopserver:
|
stopserver:
|
||||||
kill -9 `cat pelican.pid`
|
kill -9 `cat pelican.pid`
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ SRV_PID=$$BASEDIR/srv.pid
|
||||||
PELICAN_PID=$$BASEDIR/pelican.pid
|
PELICAN_PID=$$BASEDIR/pelican.pid
|
||||||
|
|
||||||
function usage(){
|
function usage(){
|
||||||
echo "usage: $$0 (stop) (start) (restart)"
|
echo "usage: $$0 (stop) (start) (restart) [port]"
|
||||||
echo "This starts pelican in debug and reload mode and then launches"
|
echo "This starts pelican in debug and reload mode and then launches"
|
||||||
echo "A pelican.server to help site development. It doesn't read"
|
echo "A pelican.server to help site development. It doesn't read"
|
||||||
echo "your pelican options so you edit any paths in your Makefile"
|
echo "your pelican options so you edit any paths in your Makefile"
|
||||||
|
|
@ -59,13 +59,14 @@ function shut_down(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_up(){
|
function start_up(){
|
||||||
|
local port=$$1
|
||||||
echo "Starting up Pelican and pelican.server"
|
echo "Starting up Pelican and pelican.server"
|
||||||
shift
|
shift
|
||||||
$$PELICAN --debug --autoreload -r $$INPUTDIR -o $$OUTPUTDIR -s $$CONFFILE $$PELICANOPTS &
|
$$PELICAN --debug --autoreload -r $$INPUTDIR -o $$OUTPUTDIR -s $$CONFFILE $$PELICANOPTS &
|
||||||
pelican_pid=$$!
|
pelican_pid=$$!
|
||||||
echo $$pelican_pid > $$PELICAN_PID
|
echo $$pelican_pid > $$PELICAN_PID
|
||||||
cd $$OUTPUTDIR
|
cd $$OUTPUTDIR
|
||||||
$PY -m pelican.server &
|
$PY -m pelican.server $$port &
|
||||||
srv_pid=$$!
|
srv_pid=$$!
|
||||||
echo $$srv_pid > $$SRV_PID
|
echo $$srv_pid > $$SRV_PID
|
||||||
cd $$BASEDIR
|
cd $$BASEDIR
|
||||||
|
|
@ -83,14 +84,17 @@ function start_up(){
|
||||||
###
|
###
|
||||||
# MAIN
|
# MAIN
|
||||||
###
|
###
|
||||||
[[ $$# -ne 1 ]] && usage
|
[[ ($$# -eq 0) || ($$# -gt 2) ]] && usage
|
||||||
|
port=''
|
||||||
|
[[ $$# -eq 2 ]] && port=$$2
|
||||||
|
|
||||||
if [[ $$1 == "stop" ]]; then
|
if [[ $$1 == "stop" ]]; then
|
||||||
shut_down
|
shut_down
|
||||||
elif [[ $$1 == "restart" ]]; then
|
elif [[ $$1 == "restart" ]]; then
|
||||||
shut_down
|
shut_down
|
||||||
start_up
|
start_up $$port
|
||||||
elif [[ $$1 == "start" ]]; then
|
elif [[ $$1 == "start" ]]; then
|
||||||
if ! start_up; then
|
if ! start_up $$port; then
|
||||||
shut_down
|
shut_down
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue