Na Na
Na Na

Reputation: 41

django custom external libraries

I want to add some Python scripts for usage in my project. I am using django, python27, apache, mysql, mod_wsgi. The scripts can be ran by themselves outside of Django. And they do. However, I want to add them to my django project for usage throughout my project. I added sys.path.append('path to my scripts') to my settings.py file. However, when I do an "from scripts import *" in a django view I get an import error saying the module does not exist. Any ideas on how to accomplish this?

Upvotes: 2

Views: 2694

Answers (1)

Dave Stephenson
Dave Stephenson

Reputation: 45

Have you added an __init__.py file into your scripts folder to make the folder a python package? That file differentiates a regular folder from a python package (among other things).

See python docs for more info: http://docs.python.org/2/tutorial/modules.html

Cheers

Dave

Upvotes: 1

Related Questions