pydev directory django shell - pydev

I'm using PyDev in a django project of mine.
When I start the django sheel, the os.getcwd() command returns my home folder.
This is bad, since my code points to some resources by relative paths, assuming as current directory the directory containing the manage.py.
In this post (http://stackoverflow.com/questions/2746342/pydev-and-django-pydev-breaking-django-shell) someone recommended to use absolute paths to avoid this problem.
But I think it is a very bad practice, since things will not work when other people checkout the code into their computers.
The closest hint I found here:
http://old.nabble.com/-pydev---Users--how-to-set-working-directory-for-console--td25328455.html
It seems we can use "Run/Debug Settings" to set the current directory associated to a "runnable module". However, in this way we cannot associate the setting to the django console. I have tried to associate it with the manage.py, but it did not work.
So, the question: how to define the working directory of django shell?
Thank you,
Leonardo

Related

How to find out current directory and go to a directory in MySQL console?

I have the following instruction in I need to perform to run a web app I that have received:
"Go to the directory where the app is unpacked and type 'gradle jettyRun'."
Sounds simple enough, if you know the commands for finding out your current directory and changing it. The problem is, searching for these basic things only nets a huge amounts of irrelevant answers to much more advanced questions where the same terms are used with a slightly different meaning. So what do they exactly mean by what they say and how do I achieve that? It sound's so simple I'm almost embarrased to have to ask it, yet I'm still dumbfounded by the MySQL command line enough to have to.
This has nothing to do with the MySQL command line (>>>), or MySQL itself. This is simply saying:
Open your terminal or shell. In Windows, this is called Command Prompt.
Change the directory to where the files are located, you do this with the cd (change directory) command.
Next you simply type gradle jettyRun.

.emacs.d folder equivalent for eclipse

I want to know if there is any place where eclipse stores all my configurations so that only the config files can be ported across different machines(even different OS's)
If I spend my time customizing eclipse on my desktop , spending the same amount of time on every machine I work on is a no brainier. I was hoping eclipse stores its files in some directory in home directory(~/.emacs.d on linux/mac mainly, but use windows often as well) just like emacs does. With this I can easily put all my configurations under VCS and get exactly the same look and feel on every machine. I have done this for emacs actually and it works great. Like this https://github.com/anooprh/dotfiles/tree/master/emacs.d
I could not find anything like that for eclipse. The closest I could find was .eclipse folder in home directory
[user#localhost .eclipse]$ pwd
/home/user/.eclipse
[user#localhost .eclipse]$ ls
org.eclipse.platform_4.4.1_1473617060_linux_gtk_x86_64 org.eclipse.platform_4.4.1_1756587775_linux_gtk_x86_64
I dont know what these two directories. Inside that there were was a configuration directory as well, but could not find anything useful.
I want to know from people who have been using eclipse for some time as to how they manage to port their config files from one machine to another.
Thanks in advance

Can I test my app in a EGit repository with Xampp locally?

I am having trouble setting up the testing mentioned in the title because of the folder structures for Xampp and Git/EGit respectively. Can anyone recommend a guide or tutorial on how to do this?
Given Xampp is looking for the .htdocs/appname/ folder for testing the app but folder structure can be something like .htdocs/repositoryname/appfoldername, they are hard to match. Has anyone solved this?
Or should I be testing with some other software which is suitable for testing PHP projects in Git repositories?
You could make a symbolic link (even on Windows) in order for .httdocs/appname to refer to .htdocs/repository/appfoldername (with option Options FollowSymLinks set in the <Directory> section of your Xampp httd.conf file)
The OP alieninlondon reports:
I found another very easy way.
Simply by putting the repository directory in the .htdocs folder and then accessing the app through localhost/repositoryfolder/appfolder in my webbrowser worked perfectly for me.

How to generate phpDoc documentation for a specific folder in Netbeans IDE?

Due to the fact that we need to integrate the Zend Framework on our project root, and that generating that documentation will be useless and take long time, I would like to generate documentation for all files inside application folder only.
Does anyone know how I can generate documentation for a specific project folder, trough Netbeans 7.0 interface?
Update:
The best I've found so far was to:
Open the terminal window from netbeans, and type:
sudo phpdoc -d public_html/yoursite.dev/application/ -t public_html/yoursite.dev/docs/
Update 2
Let's suppose our Zend library is inside projectrootname/library/Zend we also can try, by going to: Tools > Options > Php > PhpDoc and place the following:
/usr/bin/phpdoc -i library/Zend/ -o HTML:frames:earthli
At least for me, that doesn't seem to work, because, when I try to generate the documentation, I get permission error issues displayed on the output window.
Thanks
The -d/--directory option [1] should be used to highlight the most high-level code directory that you want phpDocumentor to start reading from. If your Zend folder is at or above the level of your application directory, then just using --directory /path/to/application should help you document only your application code.
If your Zend folder is somewhere inside your application (e.g. in your app's ./lib folder), then you can use the -i/--ignore option [2] to tell phpDocumentor about any directories that it will see but should ignore, --ignore *zend*. Just be aware that formatting your ignore value can be tricky, so see the examples in the manual. Also, be aware that as phpDocumentor runs, you will see these ignored folders and files being listed in the output... phpDocumentor "ignores" them by not generating docs for those files. It does, however, still need to parse them, in case those objects are referenced in files that do get documented.
[1] -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.command-line.directory
[2] -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.command-line.ignore

how to run doctrine.php in command prompt

I'm trying to use Doctrine with Zend, I have copied the doctrine.php and doctrine file in the script folder in the Source Files folder.
However when I type in command prompt following command: "php doctrine.php" by entering in the scripts folder, Nothing happens, there is no error printed, the cursor just goes to next line. Can someone please tell me how can I use doctrine.php.
When using Guilherme's integration suite, you need to do a couple of things.
Download / clone the Doctrine Common, DBAL and ORM libraries and make sure they're available in your include path. For this, I usually just copy the lib/Doctrine code from each into my project's library folder. If using git, you can add them as subtree splits but that's a topic for another time ;-)
You also need the Symfony Console and Yaml namespaces. Again, it's easiest to place them in your project's library folder under library/Symfony/Component/Console and library/Symfony/Component/Yaml. These usually come as submodule dependencies in the Doctrine libraries but you can also get them from their github pages
Console
Yaml
Remove the bootstrap('Config') call from the doctrine.php script. Don't know what Guilherme was thinking there :-)
That's it, from there it should work as expected.