Arik
Arik

Reputation: 71

Django and pure Python

I want to create a web app with Django and integration of Selenium and Python-Docker API. Where inside the Django project is the correct place to put the Selenium scripts so users will be able the run it by a puse of a button? I've seen some thred saying inside a 'view', but is is a lot of logic that I've sprated into multipale .py files.

Upvotes: 1

Views: 347

Answers (1)

rahnama7m
rahnama7m

Reputation: 977

You must import Selenium package inside another file such as sel-functions.py inside your app.

Then you define your class or functions inside this file. Finally you can import all those functionality to your views.py file.

This is best and cleanest way to work with another package or functionality in Django project. Also if multiple apps of your project need to sel-functions.py you can put that in your project directory beside settings.py.

Also, if your code has grown so much that it has multiple files, you need to define a package for your intended work and define it as an application in your project.

Upvotes: 1

Related Questions