Skip to content

Commit

Permalink
Merge pull request #1 from TOMToolkit/dev
Browse files Browse the repository at this point in the history
Build TNS Report Form Module for TOM Toolkit
  • Loading branch information
jchate6 authored Dec 14, 2023
2 parents 8033c4b + 608d450 commit 815f90a
Show file tree
Hide file tree
Showing 26 changed files with 2,972 additions and 2 deletions.
121 changes: 121 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Default ignored files
/shelf/
/workspace.xml

# Scratch files
scratch/

# Media files
media/
data/

# Cache
tmp/

# Development database
*.sqlite3

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
*local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyCharm
.idea/

# emacs
*~

# Linting
.flake8

# VS Code
.vscode/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
.venv/
.venv
venv/
env/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,46 @@
# tns_report
TOMtoolkit module for reporting transients to the TNS
# Transient Name Server (TNS) Report and Classification plugin for TOM Toolkit
TOMtoolkit module for reporting transients to the TNS

## Installation

1. Install the package into your TOM environment:
```bash
pip install tom-tns
```

2. In your project `settings.py`, add `tom_tns` to your `INSTALLED_APPS` setting:

```python
INSTALLED_APPS = [
...
'tom_tns',
]
```

3. Add your TNS credentials to your `settings.py` if they don't already exist for the TNS Broker.

If you don't have access to a TNS Bot for your TOM, you can make one from the [TNS website](https://www.wis-tns.org/bots).

NOTE: If you are testing on the sandbox, the sandbox is only synced every Sunday, so new bots created using the above link
won't show up until after the next update.

```python
BROKERS = {
...
'TNS': {
'bot_id': os.getenv('TNS_BOT_ID', ''), # This is the BOT ID you plan to use to submit to TNS
'bot_name': os.getenv('TNS_BOT_NAME', ''), # This is the BOT name associated with the above ID
'api_key': os.getenv('TNS_API_KEY', ''), # This is the API key for the associated BOT
'tns_base_url': 'https://sandbox.wis-tns.org/api', # This is the sandbox URL. Use https://www.wis-tns.org/api for live submission.
'group_name': os.getenv('TNS_GROUP_NAME', ''), # Optional. Include if you wish to use an affiliated Group Name.
},
}
```

5. Include the tom_tns URLconf in your project `urls.py`:
```python
urlpatterns = [
...
path('tns/', include('tom_tns.urls', namespace='tns')),
]
```
22 changes: 22 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tom_tns_base.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()
Loading

0 comments on commit 815f90a

Please sign in to comment.