Skip to content
Advertisement

I can’t find the code of a Ruby web application

I’m super new to web development, but not new to programming as a whole. I’m extremely confused by this application which I was pulled into fixing because the person who normally does it can’t anymore.

This may be a silly question, but I can’t find the code or any HTML that contains the actual web pages. In the main folder, ~/myapp, there contains:

- README.txt
- build
- env
    - bin
    - include
    - lib
    - local
    - man
    - passenger_wsgi.py
    - passenger_wsgi.pyc
    - pip-selfcheck.json
    - public
        - favicon.gif
        - favicon.ico
    - quickstart.html
    - sd.html
    - tmp
- error.log
- favicon.gif
- favicon.ico
- get-pip.py
- phpinfo.php
- pylibs
- quickstart.html
- sd.log
- myapp_flask

Observations:

  • env/bin/, env/include/, and env/lib/ all have what appear to be versions of python in them.
  • env/local/ contains its own bin/, include/, and lib/ directories that contain the exact same thing as the others.
  • tmp contains the standard restart.txt used for Apache rails applications. (Note: touching this does restart the server, so this env/ directory is linked to the application itself.).

Questions:

  • Does anyone recognize this file structure? What application type is it? Php? Rails? Something else?
  • Does anyone know where I could look for the code that contains the actual web page? This is a full-fledged, live webpage that people have been using for a while, but I can’t find the html (not even for the homepage). I’ve been searching for days, so I know I’m going about this wrong.

Additional notes:

This error occurs when I restart the web application with touch tmp/restart.txt/

Web application could not be started
An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.
Raw process output:
Traceback (most recent call last):
  File "/usr/share/passenger/helper-scripts/wsgi-loader.py", line 26, in <module>
    import sys, os, re, imp, threading, signal, traceback, socket, select, struct, logging, errno
  File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref

both quickstart.html contents are identical:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>DreamHost</title>
        <link media="all" rel="stylesheet" type="text/css" href="http://dreamhost.com/wp-content/themes/dreamhost/style.css" />
</head>
<body id="domains">
        <div class="w1">
                <div class="w2">
                        <div id="wrapper">
                                <div id="header">
                                        <strong class="comingsoon-logo"><a href="http://www.dreamhost.com/">DreamHost Imagine the Web, Your Way</a></strong>
                                </div>
                                <div class="main" style="padding-bottom: 24px">
                                        <h1>sendsomething.net Coming Soon!</h1>
                                        <div class="holder">
                                                <div class="content">
                                                        <p>The DreamHost customer who owns sendsomething.net has not yet uploaded their website or has chosen to leave this holding page active.</p>
                                                        <p>If you are the owner of this domain, you'll find your login information contained within the emails sent to you when your account was activated. Once logged in, you'll be able to delete this page (quickstart.html) and upload your new site.</p>
                                                        <p>Here are some helpful links for getting started:</p>
                                                        <p>
                                                                <a href="https://panel.dreamhost.com/"><img src="http://images.dreamhost.com/btn-orange-webpanel.png" alt="DreamHost Web Panel" title="DreamHost Web Panel" /></a>
                                                                <a href="http://wiki.dreamhost.com/"><img src="http://images.dreamhost.com/btn-blue-wiki.png" alt="DreamHost Wiki" title="DreamHost Wiki" /></a>
                                                                <a href="http://discussion.dreamhost.com/"><img src="http://images.dreamhost.com/btn-green-discussion.png" alt="DreamHost Discussion Forum" title="DreamHost Discussion Forum" /></a>
                                                        </p>
                                                </div>
                                        </div>
                                </div>
                        </div>
                </div>
        </div>
</body>

Thank you for your time and assistance!

Edit:

Per request of answerer, Here are the contents of ~/myapp/myapp_flask/:

- .hg
- .hgignore
- backup_config.ini
- backup_db
- db_backups
- db_repo
- dbmanage.py
- doc
- dump.sql
- example_backup_config.ini
- instance
- migrate_dbs.py
- new.db
- new_bkp.db
- requirements.txt
- restored.db
- restored.dbe
- myapp
    - __init__.py
    - __init__.py.orig
    - __init__.pyc
    - app.py
    - app.pyc
    - forms.py
    - forms.pyc
    - helpers.py
    - helpers.pyc
    - static
    - templates
    - user.py
    - user.pyc
    - views.py
    - views.pyc
- myapp.wsgi
- teste.db
- webfaction.db

Advertisement

Answer

Note: This might not be a complete answer, but it might be a starting place for one.

Possibly in answer to your first question, and based on the comments from earlier, this project looks to me like it might be a Flask web application. Flask is a Python microframework that can be used to build simple or complex web applications. I’m guessing this based on the following observations:

  1. The passenger_wsgi.py file
  2. The observation of the files ending in .py made by brombeer in the comments
  3. The item at the bottom of your application structure list called myapp_flask

As far as the passenger_wsgi.py file, Passenger is a web application server used to run web applications written in things like Python, Ruby, or Node.js.

As far as brombeer’s observation about the file extensions, files that end in .py are typically Python files.

As far as that myapp_flask item, if there are contents inside this file or folder, I wonder if it might contain the main web application code. Would it be possible to check that file or folder to see if it contains application code? Warning: It might contain sensitive data (e.g., passwords, secrets, or keys), so I don’t know if it should be posted in your original post above.

So, I guess I touched on your second main question in that earlier response: you might be able to find the main web application code in the myapp_flask item. If nothing is there, however, you might be able to determine where the main application code is by looking at the contents of your passenger_wsgi.py.

In this example passenger_wsgi.py file in the Passenger documentation, it shows how an example (Django, in that case) application might be referred to in this type of file. If you open your passenger_wsgi.py in a text editor, it might a show a reference to the main application code on a line that contains the term application = (or something similar), like in the earlier example. Maybe this could help you know what the name of the application might be.

Then, you could possibly use grep to search for the application name in your file structure, if grep is available on your system. Maybe using a search command like: grep -r 'application-name' *. That might give you more clues as to where the main application code is located.

As far as the additional note about your ImportError: cannot import name _remove_dead_weakref error, I don’t know if it’s similar to this other question from the past. I would recommend caution, however, before changing up your Python 2 related setup based on answers in that other question thread, unless you are alright with whatever might happen along the way. I haven’t tried out the answers myself from that thread.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement