Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

FIX for: PY4WEB_URL_PREFIX fails if the name of an app is the same like /p/pse

Open Beginner friendly
#1,065 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

The issue is in py4web/core.py where URL_PREFIX handling strips the prefix incorrectly when app names start with the same pattern. Start by examining the register_route logic and how URL() builds links. The fix is provided in the issue body; apply it and test by creating an app with a name starting with the prefix (like 'pse') and verify that links, redirects, static paths, and form actions include the correct /p prefix.

Written by the indexing model from the issue text.

Description

What ever is used a URL_PREFIX will break if the app name starts with the same pattern.

Using PY4WEB_URL_PREFIX=/p
So any app whose name starts with p gets links, redirects, static paths and form actions without the /p prefix. The routes themselves are registered correctly by register_route, so if you type /p/pse directly the page should load. Anything built with URL() after that breaks.

The fix

py4web/core.py:

url_prefix = os.environ.get("PY4WEB_URL_PREFIX", "")
if url_prefix and prefix and (
    prefix == url_prefix or prefix.startswith(url_prefix.rstrip("/") + "/")):
    url_prefix = ""
Dominant language
HTML
Stars
319
Forks
144
Avg merge
6d 20h
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from web2py/py4web

All issues in web2py/py4web

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.