3

EDIT: Issue is resolved. Can be marked as fixed.

You need to update peewee to the latest release (3.10.0) by running the following as app

pip install peewee --update

OR

git clone https://github.com/coleifer/peewee.git
cd peewee
python setup.py install

/Of course, I didn't resolve it on my own my own. Phuks is surrounded by angels *grin*


So close, yet so far! Almost there, but NOT yet!

In continuation with this thread. I have managed to go as far as executing the ./migrate.py scripts without error.

All went well, but...Screenshot of AttributeError page.

So the migrate.py file is ONLY for migrating from an existing installation of phuks to the latest code base and NOT for a fresh installation of Phuks. <This is my assumption as there isn't any **install.py** file in the codebase anymore>

The installation steps will have already created a throat database for you. However, this is not the database you need. You need the database of your existing Phuks installation.

For this, create a copy of your existing Phuks database and name it say, throat2. Export it as, say throat2.sql and create a copy of your Phuks database. You'll use this sql file to create a new database where you want to migrate phuks.

Follow the steps in this article to copy and export SQL databases.

Once you've created a throat2 database (where you want to migrate your phuks site), import the data using the throat2.sql file to the database throat2.

Once the data is imported the throat2 database, on the config.py file, replace throat with throat2 since we will be using the throat2 database now. Notice 'name': 'throat2' (as it's the database we will be working on from now on or where your Phuks installation will pull data from).

DATABASE = {
    'host': 'localhost',
    'name': 'throat2',
    'engine': 'MySQLDatabase',
    'charset': 'utf8mb4',
    'user': 'throat',
    'password': 'Pass1234',
}

Once done, run the ./migrate.py script and you'll have the following output.

Starting migrations
Migrate "001_initial"
Done 001_initial
Migrate "002_subcreation"
Done 002_subcreation
Migrate "003_submod"
Done 003_submod
Migrate "004_subban"
Done 004_subban
Migrate "005_banreasonlength"
change_column ('sub_ban', 'reason', <CharField: SubBan.reason>)
Done 005_banreasonlength
Migrate "006_comment_history"
Done 006_comment_history

After the above commands are executed type cd..

Next, type nano wsgi.py and the file is opened.

#!/usr/bin/env python3
""" From here we start the app in debug mode. """
import eventlet
eventlet.monkey_patch()

from app import app, socketio  # noqa
if __name__ == "__main__":
    socketio.run(app, debug=True)

I do nothing with this file and move on to the next step, which is run the following command.

./wsgi.py

The following output is displayed on my terminal .

​```
INFO:werkzeug: * Restarting with stat
WARNING:werkzeug: * Debugger is active!
INFO:werkzeug: * Debugger PIN: 336-192-212
(6555) wsgi starting up on http://127.0.0.1:5000
​```

I navigate to http://127.0.0.1:5000 but I'm getting the AttributeError page on the browser. What should I do next? Anything I may have missed? :-?

#### EDIT: Issue is resolved. Can be marked as fixed. You need to update peewee to the latest release (3.10.0) by running the following as `app` `pip install peewee --update` OR ``` git clone https://github.com/coleifer/peewee.git cd peewee python setup.py install ``` /Of course, I didn't resolve it on my own my own. Phuks is surrounded by angels \*grin* ---- So close, yet so far! Almost there, but NOT yet! In continuation with [this thread](https://phuks.co/s/phuksdev/65509). I have managed to go as far as executing the **./migrate.py** scripts without error. All went well, but...[Screenshot of AttributeError page](https://i.imgur.com/AkdrWok.jpg). So the **migrate.py** file is ONLY for migrating from an existing installation of phuks to the latest code base and NOT for a fresh installation of Phuks. <This is my assumption as there isn't any **install.py** file in the codebase anymore> The [installation steps](https://phab.phuks.co/w/setup/ubuntu/) will have already created a **throat** database for you. However, this is not the database you need. You need the database of your existing Phuks installation. For this, create a copy of your existing Phuks database and name it say, **throat2**. Export it as, say **throat2.sql** and create a copy of your Phuks database. You'll use this sql file to create a new database where you want to ***migrate*** phuks. Follow the steps in this [article](http://www.mysqltutorial.org/mysql-copy-database/) to copy and export SQL databases. Once you've created a **throat2** database (where you want to migrate your phuks site), import the data using the **throat2.sql** file to the database **throat2**. Once the data is imported the **throat2** database, on the **config.py** file, replace **throat** with **throat2** since we will be using the throat2 database now. Notice ``'name': 'throat2'`` (as it's the database we will be working on from now on or where your Phuks installation will pull data from). ``` DATABASE = { 'host': 'localhost', 'name': 'throat2', 'engine': 'MySQLDatabase', 'charset': 'utf8mb4', 'user': 'throat', 'password': 'Pass1234', } ``` Once done, run the **./migrate.py** script and you'll have the following output. ``` Starting migrations Migrate "001_initial" Done 001_initial Migrate "002_subcreation" Done 002_subcreation Migrate "003_submod" Done 003_submod Migrate "004_subban" Done 004_subban Migrate "005_banreasonlength" change_column ('sub_ban', 'reason', <CharField: SubBan.reason>) Done 005_banreasonlength Migrate "006_comment_history" Done 006_comment_history ``` After the above commands are executed type ``cd..`` Next, type ``nano wsgi.py`` and the file is opened. ``` #!/usr/bin/env python3 """ From here we start the app in debug mode. """ import eventlet eventlet.monkey_patch() from app import app, socketio # noqa if __name__ == "__main__": socketio.run(app, debug=True) ``` I do nothing with this file and move on to the next step, which is run the following command. `./wsgi.py` The following output is displayed on my terminal . ``` ​``` INFO:werkzeug: * Restarting with stat WARNING:werkzeug: * Debugger is active! INFO:werkzeug: * Debugger PIN: 336-192-212 (6555) wsgi starting up on http://127.0.0.1:5000 ​``` ``` I navigate to ``http://127.0.0.1:5000`` but I'm getting the **AttributeError** page on the browser. What should I do next? Anything I may have missed? :-?

11 comments

[–] E-werd 1 points (+1|-0)

Sorry, I should have elaborated. migrate.py is indeed for a fresh installation of Phuks, as well as to update the database when a major change is made that requires it.