How to get the root path of a pylons website - pylons

I'm using pylons to build websites. I want to write some files to a directory under the root of the project, but I don't konw how can I get the root path(project path) in the controller?

Try this:
from pylons import config
print config['pylons.paths']['root']

Related

How to get Xcode root folder directory path using Swift

How to get the Xcode project root directory?
Example: /Users/username/MyProjects/Project/. similar to ${SRCROOT}
I checked through FileManager urls and couldn't find the path.
Goal
I am running tests and would like to create a log.txt file in the project root directory.
AFAIK there is no direct way to access this, but what you can do is this for simulator builds:
Modify your xcode scheme to add an environment var SRCROOT with the value ${SRCROOT}
In your code, get the system environment using ProcessInfo:
let srcroot = ProcessInfo.processInfo.environment["SRCROOT"]

Tika server ROOT directory

How can I find the location of the tika server ROOT directory that hosts the html welcome page for the Apache Tika 1.x-SNAPSHOT Server? For example, say that maven built tika in file:///opt/tika-trunk/tika-server/target/classes/org/apache/tika/server/ , so in this path there exist all the classes that maven created. But where is the server root directory and the folder structure that someone would expect, like where is the /detectors folder? where is the /mime-types folder etc.? I am sure missing something important here, so I wish you could give me a hint...
Thanks

Ruby on Rails: FileUtils relative to server root?

When using PHP, any file manipulation is done relative to the server root, so something like mkdir("/home/website/public_html/a_directory would be used to create a directory in the public_html folder where the script is executed from.
In Rails, using the FileUtils module, it is relative to the Application's path like FileUtils.mkdir('public/a_directory') which will create a folder in the public folder of the application.
The problem I face is that from my Application, I would like to be able to create directories, move files, rename files/folders and remove file/folders relative to the server's root.
What's the best way to achieve this? OR am I missing something obvious?
Thanks,
Stefan
You can use absolute paths in FileUtil:
FileUtil.mkdir('/tmp/foo')
will create the directory foo in then servers /tmp/ directory.
Rail.root holds the root of your rails application.
You can extend the path like Rails.root.join('public','a_directory').
Remember that the DOCUMENT ROOT is Rails.root.join('public')

Grails static resource unacessible from root

I have a file named
favicon.ico
in the web-app folder (grails 2.2.1).
My app is configured to run as root app /
If I open the url
http://mydomain/favicon.ico
I got a not 404 not found.
If I try to move the file in any subfolder it works. For example if I move it to
web-app/test/favicon.ico
and I open
http://mydomain/favicon.ico
the file is correctly served.
The problem is the same if I run the app with grails run-app
You can configure in the Config.groovy to process resources in / like this:
grails.resources.adhoc.patterns = ['/*','/images/*', '/css/*', '/js/*', '/plugins/*']
http://mydomain/favicon.ico
will get a 302 to:
http://mydomain/static/favicon.ico
That should work, but I think its better to move your ico to /images

Is it possible to change Yeoman's directory structure?

I like Yeoman's features like the Package Manager (Bower), Livereload integration, Compass, etc.
Therefor, I'd like to use it to handle my public website. However, instead of using the "app" folder, I would like to put everything at the root.
I've changed the references in the grunt configuration file but still get errors when installing new package and building.
Is it possible to change the project structure?
Not as easy as it could be at the moment, but we're working on making it easily customizable.
Though I don't think you would need to. You develop in the /app folder and deploy the contents of the built /dist folder. That way it's still in the root on your server.

Resources