Metadata-Version: 2.3
Name: piprints
Version: 4.0.2
Summary: preprint server
Author: Emanuele Paolini
Author-email: emanuele.paolini@gmail.com
Requires-Python: >=3.12,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: argon2 (>=0.1.10,<0.2.0)
Requires-Dist: argon2-cffi (>=23.1.0,<24.0.0)
Requires-Dist: django (>=5.1.5,<6.0.0)
Requires-Dist: jinja2 (>=3.1.5,<4.0.0)
Requires-Dist: pillow (>=11.1.0,<12.0.0)
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: requests (>=2.32.3,<3.0.0)
Description-Content-Type: text/markdown

# INSTALL

Create your new project:

```bash
poetry new myproject
cd myproject
poetry add piprints
poetry run manage
```

Initialize the database
```bash
poetry run manage migrate
poetry run manage collectstatic --no-input
```
(or test database connection with `poetry run manage dbshell`)

Create the first user
```bash
poetry run manage createsuperuser
```

Collect static files
```bash
poetry run manage collectstatic
```

Run the server
```bash
poetry run manage runserver
```
and then connect to localhost:8000/admin/ for the initial configuration. 
You should create a SiteParameter object. 
The `id` of this object must be given to the server configuration
throught the `SITE_ID` configuration variable.
The default value is `2`, hence if you have a diffent value check the `configuration` section below.

Once an admin has been created, other user can make a request for an account (from the login page) and the admin can manage account requests.
You can then change a user's password with the command
```bash
    poetry run manage changepassword <username>
```

**Warning:** the default configuration is *not* suitable for production. You should carefully check your configuration (see section below) in particular for production you should have 
`DEBUG=False` a randomly choosen `SECRET_KEY` and possibly 
a solid database (`mysql` or `postgres` instead of `sqlite`). 

# CONFIGURATION

Configuration is loaded from environment variables.
For example, to set the `SIDE_ID` you should issue this command
```bash
export SIDE_ID=2
```
before running the server. This is not permanent. To make it permanent you can create a `.env` file (not sure where this file should be located) ad insert there all variables definition:
```
echo "SIDE_ID=2" >> .env
```
An example file listing all settings is provided in the file `.env.example`

You can check the values of settings with the command
```bash
poetry run manage diffsettings
```
# GENERAZIONE `requirements.txt`

```bash
poetry self add poetry-plugin-export
poetry export --without-hashes --format requirements.txt --output requirements.txt 
```

# BACKUP

Per fare un dump del database il comando che sembra funzionare e' questo:

da un lato:

    python manage.py dumpdata --exclude=contenttypes --exclude=auth.Permission --exclude=admin -o mydump.json

dall'altro lato:
    
    python manage.py flush   ## cancella il database!!
    python manage.py loaddata mydump.json




