odysseusmax / tg-index

Python web app to index telegram chats and serve its files for download over HTTP.
GNU General Public License v3.0
385 stars 469 forks source link

Where to save the environment variables locally? #61

Open KavyaKinjalk opened 2 years ago

KavyaKinjalk commented 2 years ago

I am trying to run this bot locally, but I cannot find where to save the .env file. Where do I save it?

imner0 commented 1 year ago

did you find out?

erickyun commented 1 year ago

did any of you find it?

KavyaKinjalk commented 1 year ago

yeah, you simply put the env file in the app directory.

On Sun, Oct 15, 2023, 8:46 AM erickyun @.***> wrote:

did any of you find it?

— Reply to this email directly, view it on GitHub https://github.com/odysseusmax/tg-index/issues/61#issuecomment-1763379019, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARHLQFKANL3MA4TYNQBHV3LX7PLKJAVCNFSM5V733TYKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZWGMZTOOJQGE4Q . You are receiving this because you authored the thread.Message ID: @.***>

imner0 commented 1 year ago

Can you explained how to name the file and how you put variables in that file can you share Screenshot both

erickyun commented 1 year ago

Can you explain please?

Like this maybe??

.env


API_ID="12345"
API_HASH="xxxx"
SESSION_STRING = "xxxxxx"
INDEX_SETTINGS="{
  "index_all": true,
  "index_private": false,
  "index_group": false,
  "index_channel": true,
  "exclude_chats": [],
  "include_chats": []
}"
imner0 commented 1 year ago

Thank you bro.

Did you try to run with replit? I tried so many time but didn't work

erickyun commented 1 year ago

Thank you bro.

Did you try to run with replit? I tried so many time but didn't work

How did you setup .env file? Screenshot please?

KavyaKinjalk commented 1 year ago

you are correctl using the env file. You just have to put the env file in the "app" directory. Replit does not work anymore because it changed how dependency packages are installed, so you cannot install telethon. Some packages redundancy has changed as well, such as for aiohttp-jinja2. So you cannot run it on replit further, but it is possible to run it locally.

KavyaKinjalk commented 1 year ago

The location of env file is on the left, and right is the format of env file. It is rte same as what you sent.

KavyaKinjalk commented 1 year ago

https://i.imgur.com/jPjXiov.png

On Sun, Oct 15, 2023, 2:03 PM Kavya Kinjalk @.***> wrote:

The location of env file is on the left, and right is the format of env file. It is rte same as what you sent.

erickyun commented 1 year ago

The location of env file is on the left, and right is the format of env file. It is rte same as what you sent.

Which python version do you have sir?

I am trying to run this on Android Termux and Im still getting this error?


~/tg-index $ python3 -m app
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/tg-index/app/config.py", line 22, in <module>
    api_hash = os.environ["API_HASH"]
               ~~~~~~~~~~^^^^^^^^^^^^
  File "<frozen os>", line 679, in __getitem__
KeyError: 'API_HASH'

Please set the API_ID and API_HASH environment variables correctly
You can get your own API keys at https://my.telegram.org/apps
~/tg-index $
erickyun commented 1 year ago

you are correctl using the env file. You just have to put the env file in the "app" directory. Replit does not work anymore because it changed how dependency packages are installed, so you cannot install telethon. Some packages redundancy has changed as well, such as for aiohttp-jinja2. So you cannot run it on replit further, but it is possible to run it locally.

Could you maybe share your tg-index as zip? Also python version and which modules version you use?