<p>First, install Evennia on your local machine with [[Getting Started]]. If you’re new to PyCharm,
loading your project is as easy as selecting the <codeclass="docutils literal notranslate"><spanclass="pre">Open</span></code> option when PyCharm starts, and browsing to
your game folder (the one created with <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span><spanclass="pre">--init</span></code>). We refer to it as <codeclass="docutils literal notranslate"><spanclass="pre">mygame</span></code> here.</p>
<p>If you want to be able to examine evennia’s core code or the scripts inside your virtualenv, you’ll
<li><p>Go to <codeclass="docutils literal notranslate"><spanclass="pre">File</span><spanclass="pre">></span><spanclass="pre">Open...</span></code></p></li>
<li><p>Select the folder (i.e. the <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> root)</p></li>
<li><p>Select “Open in current window” and “Add to currently opened projects”</p></li>
<li><p>Go to <codeclass="docutils literal notranslate"><spanclass="pre">File</span><spanclass="pre">></span><spanclass="pre">Settings...</span><spanclass="pre">></span><spanclass="pre">Project:</span><spanclass="pre">\<mygame\></span><spanclass="pre">></span><spanclass="pre">Project</span><spanclass="pre">Interpreter</span></code></p></li>
<li><p>Click the Gear symbol <codeclass="docutils literal notranslate"><spanclass="pre">></span><spanclass="pre">Add</span><spanclass="pre">local</span></code></p></li>
<li><p>Navigate to your <codeclass="docutils literal notranslate"><spanclass="pre">evenv/scripts</span><spanclass="pre">directory</span></code>, and select Python.exe</p></li>
</ol>
<p>Enjoy seeing all your imports checked properly, setting breakpoints, and live variable watching!</p>
<h2>Attaching PyCharm debugger to Evennia<aclass="headerlink"href="#attaching-pycharm-debugger-to-evennia"title="Permalink to this headline">¶</a></h2>
<olclass="simple">
<li><p>Launch Evennia in your preferred way (usually from a console/terminal)</p></li>
<li><p>Open your project in PyCharm</p></li>
<li><p>In the PyCharm menu, select <codeclass="docutils literal notranslate"><spanclass="pre">Run</span><spanclass="pre">></span><spanclass="pre">Attach</span><spanclass="pre">to</span><spanclass="pre">Local</span><spanclass="pre">Process...</span></code></p></li>
<li><p>From the list, pick the <codeclass="docutils literal notranslate"><spanclass="pre">twistd</span></code> process with the <codeclass="docutils literal notranslate"><spanclass="pre">server.py</span></code> parameter (Example: <codeclass="docutils literal notranslate"><spanclass="pre">twistd.exe</span><spanclass="pre">--nodaemon</span><spanclass="pre">--logfile=\<mygame\>\server\logs\server.log</span><spanclass="pre">--python=\<evennia</span><spanclass="pre">repo\>\evennia\server\server.py</span></code>)</p></li>
<p>Of course you can attach to the <codeclass="docutils literal notranslate"><spanclass="pre">portal</span></code> process as well. If you want to debug the Evennia launcher
or runner for some reason (or just learn how they work!), see Run Configuration below.</p>
<div><p>To make the process less tedious you can apply a filter in settings to show only the <aclass="reference external"href="http://server.py">server.py</a>
process in the list. To do that navigate to: <codeclass="docutils literal notranslate"><spanclass="pre">Settings/Preferences</span><spanclass="pre">|</span><spanclass="pre">Build,</span><spanclass="pre">Execution,</span><spanclass="pre">Deployment</span><spanclass="pre">|</span><spanclass="pre">Python</span><spanclass="pre">Debugger</span></code> and then in <codeclass="docutils literal notranslate"><spanclass="pre">Attach</span><spanclass="pre">to</span><spanclass="pre">process</span></code> field put in: <codeclass="docutils literal notranslate"><spanclass="pre">twistd.exe"</span><spanclass="pre">--nodaemon</span></code>. This is an
example for windows, I don’t have a working mac/linux box.
<h2>Setting up an Evennia run configuration<aclass="headerlink"href="#setting-up-an-evennia-run-configuration"title="Permalink to this headline">¶</a></h2>
<li><p>Go to <codeclass="docutils literal notranslate"><spanclass="pre">Run</span><spanclass="pre">></span><spanclass="pre">Edit</span><spanclass="pre">Configutations...</span></code></p></li>
<li><p>Click the plus-symbol to add a new configuration and choose Python</p></li>
<li><p>Add the script: <codeclass="docutils literal notranslate"><spanclass="pre">\<yourrepo\>\evenv\Scripts\evennia_launcher.py</span></code> (substitute your virtualenv if
it’s not named <codeclass="docutils literal notranslate"><spanclass="pre">evenv</span></code>)</p></li>
<li><p>Ensure the chosen interpreter is from your virtualenv</p></li>
<li><p>Set Working directory to your <codeclass="docutils literal notranslate"><spanclass="pre">mygame</span></code> folder (not evenv nor evennia)</p></li>
<h2>Alternative run configuration - utilizing logfiles as source of data<aclass="headerlink"href="#alternative-run-configuration-utilizing-logfiles-as-source-of-data"title="Permalink to this headline">¶</a></h2>
<p>This configuration takes a bit different approach as instead of focusing on getting the data back
through logfiles. Reason for that is this way you can easily separate data streams, for example you
rarely want to follow both server and portal at the same time, and this will allow it. This will
also make sure to stop the evennia before starting it, essentially working as reload command (it
will also include instructions how to disable that part of functionality). We will start by defining
a configuration that will stop evennia. This assumes that <codeclass="docutils literal notranslate"><spanclass="pre">upfire</span></code> is your pycharm project name, and
also the game name, hence the <codeclass="docutils literal notranslate"><spanclass="pre">upfire/upfire</span></code> path.</p>
<li><p>Go to <codeclass="docutils literal notranslate"><spanclass="pre">Run</span><spanclass="pre">></span><spanclass="pre">Edit</span><spanclass="pre">Configutations...</span></code>\</p></li>
<li><p>Go to <codeclass="docutils literal notranslate"><spanclass="pre">Run</span><spanclass="pre">></span><spanclass="pre">Edit</span><spanclass="pre">Configutations...</span></code>\</p></li>
<li><p>Navigate to the <codeclass="docutils literal notranslate"><spanclass="pre">Logs</span></code> tab and add the log files you would like to follow. The picture shows
adding <codeclass="docutils literal notranslate"><spanclass="pre">portal.log</span></code> which will show itself in <codeclass="docutils literal notranslate"><spanclass="pre">portal</span></code> tab when running:
<li><p>Head back to <codeclass="docutils literal notranslate"><spanclass="pre">Configuration</span></code> tab and press the <codeclass="docutils literal notranslate"><spanclass="pre">+</span></code> sign at the bottom, under <codeclass="docutils literal notranslate"><spanclass="pre">Before</span><spanclass="pre">launch....</span></code>
and select <codeclass="docutils literal notranslate"><spanclass="pre">Run</span><spanclass="pre">another</span><spanclass="pre">configuration</span></code> from the submenu that will pop up.</p></li>
<li><p>Click <codeclass="docutils literal notranslate"><spanclass="pre">stop</span><spanclass="pre">evennia</span></code> and make sure that it’s added to the list like on the image above.</p></li>
<li><p>Click <codeclass="docutils literal notranslate"><spanclass="pre">Apply</span></code> and close the run configuration window.</p></li>
<p>You are now ready to go, and if you will fire up <codeclass="docutils literal notranslate"><spanclass="pre">start</span><spanclass="pre">evennia</span></code> configuration you should see
<li><aclass="reference internal"href="#setting-up-the-project-interpreter">Setting up the project interpreter</a></li>
<li><aclass="reference internal"href="#attaching-pycharm-debugger-to-evennia">Attaching PyCharm debugger to Evennia</a></li>
<li><aclass="reference internal"href="#setting-up-an-evennia-run-configuration">Setting up an Evennia run configuration</a></li>
<li><aclass="reference internal"href="#alternative-run-configuration-utilizing-logfiles-as-source-of-data">Alternative run configuration - utilizing logfiles as source of data</a></li>