The port doesn't count as part of the town. So when the ships are there it only registers that they are on tile of sea, no different from being in the middle of nowhere.
But you can recruit and retrain ships stationed in a port from the town. So why couldn't you, in theory, have a naval academy from the town?
Bookmarks