localrun


Namelocalrun JSON
Version 1.1.2 PyPI version JSON
download
home_pageNone
SummaryA simple local server to run your Python applications.
upload_time2024-10-25 17:47:00
maintainerNone
docs_urlNone
authorMrFidal
requires_python>=3.6
licenseNone
keywords local server python applications development server web server
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LocalRun

`localrun` is a Python package that provides an easy way to run a simple HTTP server locally, similar to the `php -S` command. It supports both silent and non-silent modes for logging HTTP requests.

## Installation

You can install `localrun` using pip:

```bash
pip install localrun
```

## Command-Line Usage

You can run the server directly from the command line using the following syntax:

### Start Server with Host and Port

```bash
localrun --host <HOST> --port <PORT>
```

### Start Server with Silent Mode

To run the server in silent mode, which suppresses log output:

```bash
localrun --host <HOST> --port <PORT> --silent
```

### Examples

1. **Start Server on Default Host and Port (127.0.0.1:8000)**

   ```bash
   localrun
   ```

2. **Start Server on Specified Host and Port**

   ```bash
   localrun --host 127.0.0.1 --port 8000
   ```

3. **Start Server with Silent Mode**

   ```bash
   localrun --host 127.0.0.1 --port 8000 --silent
   ```

## Programmatic Usage

You can also use `localrun` as a module in your Python scripts.

### Example Script

Here’s how to start the server programmatically:

```python
# example_script.py
import localrun

# Start the server in silent mode
running_address = localrun.run_server('127.0.0.1', 8000, silent=True)

# Print the running address
print(f"Running port is: {running_address}")
```

### Running Without Silent Mode

To start the server without silent mode:

```python
# example_script.py
import localrun

# Start the server
running_address = localrun.run_server('127.0.0.1', 8000)

# Print the running address
print(f"Running port is: {running_address}")
```

## Logging Format

In non-silent mode, the server logs HTTP requests in the following format :

```
localrun - - [25/Oct/2024 23:01:50] "GET /new/instance/ HTTP/1.1" 200 -
```


## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "localrun",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "local server, Python applications, development server, web server",
    "author": "MrFidal",
    "author_email": "mrfidal@proton.me",
    "download_url": "https://files.pythonhosted.org/packages/fc/32/8945c23ed4859750c4ddaafadb771cf22626aa2e40c392520475cb24e7af/localrun-1.1.2.tar.gz",
    "platform": null,
    "description": "# LocalRun\r\n\r\n`localrun` is a Python package that provides an easy way to run a simple HTTP server locally, similar to the `php -S` command. It supports both silent and non-silent modes for logging HTTP requests.\r\n\r\n## Installation\r\n\r\nYou can install `localrun` using pip:\r\n\r\n```bash\r\npip install localrun\r\n```\r\n\r\n## Command-Line Usage\r\n\r\nYou can run the server directly from the command line using the following syntax:\r\n\r\n### Start Server with Host and Port\r\n\r\n```bash\r\nlocalrun --host <HOST> --port <PORT>\r\n```\r\n\r\n### Start Server with Silent Mode\r\n\r\nTo run the server in silent mode, which suppresses log output:\r\n\r\n```bash\r\nlocalrun --host <HOST> --port <PORT> --silent\r\n```\r\n\r\n### Examples\r\n\r\n1. **Start Server on Default Host and Port (127.0.0.1:8000)**\r\n\r\n   ```bash\r\n   localrun\r\n   ```\r\n\r\n2. **Start Server on Specified Host and Port**\r\n\r\n   ```bash\r\n   localrun --host 127.0.0.1 --port 8000\r\n   ```\r\n\r\n3. **Start Server with Silent Mode**\r\n\r\n   ```bash\r\n   localrun --host 127.0.0.1 --port 8000 --silent\r\n   ```\r\n\r\n## Programmatic Usage\r\n\r\nYou can also use `localrun` as a module in your Python scripts.\r\n\r\n### Example Script\r\n\r\nHere\u2019s how to start the server programmatically:\r\n\r\n```python\r\n# example_script.py\r\nimport localrun\r\n\r\n# Start the server in silent mode\r\nrunning_address = localrun.run_server('127.0.0.1', 8000, silent=True)\r\n\r\n# Print the running address\r\nprint(f\"Running port is: {running_address}\")\r\n```\r\n\r\n### Running Without Silent Mode\r\n\r\nTo start the server without silent mode:\r\n\r\n```python\r\n# example_script.py\r\nimport localrun\r\n\r\n# Start the server\r\nrunning_address = localrun.run_server('127.0.0.1', 8000)\r\n\r\n# Print the running address\r\nprint(f\"Running port is: {running_address}\")\r\n```\r\n\r\n## Logging Format\r\n\r\nIn non-silent mode, the server logs HTTP requests in the following format :\r\n\r\n```\r\nlocalrun - - [25/Oct/2024 23:01:50] \"GET /new/instance/ HTTP/1.1\" 200 -\r\n```\r\n\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple local server to run your Python applications.",
    "version": "1.1.2",
    "project_urls": null,
    "split_keywords": [
        "local server",
        " python applications",
        " development server",
        " web server"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a64028b8b2661ee3a2069f8badd9055279ea9f9ecc6a48e6d4cda08341bf641",
                "md5": "0936412ffd2b999fb45d4206561ded71",
                "sha256": "87cfd58fde6ffd0066c33a4003c1a7912e3e6a6246b45c114418bbfff651adf1"
            },
            "downloads": -1,
            "filename": "localrun-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0936412ffd2b999fb45d4206561ded71",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4573,
            "upload_time": "2024-10-25T17:46:58",
            "upload_time_iso_8601": "2024-10-25T17:46:58.980956Z",
            "url": "https://files.pythonhosted.org/packages/4a/64/028b8b2661ee3a2069f8badd9055279ea9f9ecc6a48e6d4cda08341bf641/localrun-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc328945c23ed4859750c4ddaafadb771cf22626aa2e40c392520475cb24e7af",
                "md5": "70650c8b28d35bfcf7eb62ce5c940711",
                "sha256": "fd52a5e4249dfb8cbe7507165556ae512d3d7aa2d6f90e072d1b07a77b9fe383"
            },
            "downloads": -1,
            "filename": "localrun-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "70650c8b28d35bfcf7eb62ce5c940711",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3978,
            "upload_time": "2024-10-25T17:47:00",
            "upload_time_iso_8601": "2024-10-25T17:47:00.817426Z",
            "url": "https://files.pythonhosted.org/packages/fc/32/8945c23ed4859750c4ddaafadb771cf22626aa2e40c392520475cb24e7af/localrun-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-25 17:47:00",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "localrun"
}
        
Elapsed time: 0.78348s