shazow / composer

Static website generator, structure/syntax-agnostic.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to change the port 8080?

luckypoem opened this issue · comments

hi.
when i run "composer serve examples/simple_mako/index.json",
it shows my server's port 8080 has been used.how to change the port 8080?

Add --port 12345 to serve it on port 12345.

Specifically,

$ composer serve --help
usage: composer serve [-h] [--host HOST] [--port PORT] [--base-path DIR]
                      [--index-type {auto,json,object}]
                      INDEX

positional arguments:
  INDEX

optional arguments:
  -h, --help            show this help message and exit
  --host HOST           (Default: localhost)
  --port PORT           (Default: 8080)
  --base-path DIR       Treat relative paths in the Index from this path.
                        (Default: Path of json index file or cwd when index
                        type is object)
  --index-type {auto,json,object}
                        How to interpret the INDEX value. 'auto' will try to
                        guess, 'object' is a Python dotted object path like
                        'foo.bar:MyIndex'. (Default: auto)

hi.
i run "composer serve --port 7641 examples/simple_mako/index.json &",pls see below.it shows no error.why i visit
http://as3.brite.biz:7641/ in firefox,it shows:"Unable to connect"?

socket.error: [Errno 98] Address already in use
as3:/composer# composer serve --port 7641 examples/simple_mako/index.json
2013-11-07 16:26:28,889 INFO [werkzeug] * Running on http://localhost:7641/
2013-11-07 16:26:28,890 INFO [werkzeug] * Restarting with reloader
^Cas3:
/composer#
as3:/composer# composer serve --port 7641 examples/simple_mako/index.json &
[2] 18103
as3:
/composer# 2013-11-07 16:26:58,451 INFO [werkzeug] * Running on http://localhost:7641/
2013-11-07 16:26:58,452 INFO [werkzeug] * Restarting with reloader
as3:~/composer#

socket.error: [Errno 98] Address already in use

That's your error.

The port is already in use. Try a different port.

hi.
u misunderstood .that's port 8080 .i already changed to 7641

My bad.

You're serving it on localhost.

why i visit http://as3.brite.biz:7641/ in firefox,it shows:"Unable to connect"?

You're visiting on some domain that is not localhost. This is why it's not working.

Composer is built to be a static site generator, not a server. While you could set the --host to be visible on an external ethernet device, I strongly advise against it as it's not what it's built for. There may be significant security implications for doing that.

The built-in composer server is built only for local development.

another question:
as3:/composer# ls
build composer LICENSE.txt optional.txt setup.cfg test
CHANGES.rst examples MANIFEST.in README.rst setup.py
as3:
/composer# ls build
foo post static
as3:/composer# ls build/post
1
as3:
/composer# ls build/foo
index.html
as3:/composer# cd build/foo
as3:
/composer/build/foo# Rwebserver 8753 & (Rwebserver is a ruby app for serving static site)

then i can visit http://as3.brite.biz:8753/,but when i visit http://as3.brite.biz:8753/post/1,it shows:Not Found,
why?

i do see 1.md here:
as3:/composer/examples/simple_mako/posts# ls
1.md test1.md
as3:
/composer/examples/simple_mako/posts#

It should be build/post/1/index.html. There is something wrong with your indexer, presumably it's writing into a file called build/post/1 instead of build/post/1/index.html.

i don't understand very much.it's all according to ur site: https://github.com/shazow/composer,i didn't edit indexer.py,
how can i meet an error?

and i cloned ur shazow.net's sourcecode: http://cp.brite.biz/,but when i visit http://cp.brite.biz/everything/laser-eyes,it shows "not found" again.why?

@luckypoem Probably because everything is a git submodule that needs to be pulled too.

Honestly, I suspect Composer might not be the best option for you. It's currently geared for more advanced users who are willing to read and understand the source code and how it works.

If you want to dive in, I suggest starting with:
https://github.com/shazow/composer/blob/master/composer/writer.py#L71
https://github.com/shazow/composer/blob/master/composer/index.py

Otherwise, I would suggest looking at alternatives like:
http://docs.getpelican.com/
http://www.blogofile.com/
http://jekyllrb.com/

Or search for more.

hi.
finally i installed it here successfully: http://cps.brite.biz.st/ ,but how to paginate?

@luckypoem Please don't use my content on your site. It is copyrighted and not licensed to be reused by others without permission.

There is no built-in pagination helpers, you'll need to make it yourself.

Again, I don't think this tool is ideal for the level of involvement you may be looking for. Please consider using one of the the other static site generators here: http://staticsitegenerators.net/