Find a file
2025-02-28 13:03:29 +00:00
make_post_sell Content now display thumbnails and play buttons for a broader range of audio and video file formats, enhancing the viewing experience for more media types 2025-02-15 15:30:17 +00:00
.gitignore w00t this Caddyfile was able to work in development! 2022-06-29 13:19:01 -04:00
.gitlab-ci.deploy.yml run deploy jobs at the same time 2024-07-05 12:59:51 -04:00
.gitlab-ci.yml remove SMTP server from dev and use console logs instead. 2025-01-10 13:10:37 +00:00
Caddyfile Enable gzip & fix favicon 2022-06-29 14:03:41 -04:00
development.ini remove next query string from authentication logic. 2024-12-14 21:57:08 +00:00
journal.rst Update journal.rst 2025-02-28 13:03:29 +00:00
Makefile remove SMTP server from dev and use console logs instead. 2025-01-10 13:10:37 +00:00
MANIFEST.in Time to open the sauce : ) 2021-12-31 21:39:40 -05:00
pytest.ini Time to open the sauce : ) 2021-12-31 21:39:40 -05:00
README.rst remove SMTP server from dev and use console logs instead. 2025-01-10 13:10:37 +00:00
requirements-dev.txt Time to open the sauce : ) 2021-12-31 21:39:40 -05:00
requirements-prod.txt Time to open the sauce : ) 2021-12-31 21:39:40 -05:00
requirements-test.txt Time to open the sauce : ) 2021-12-31 21:39:40 -05:00
requirements.py3.txt sunset miscutils! 2022-07-05 14:50:20 -04:00
requirements.txt sunset miscutils! 2022-07-05 14:50:20 -04:00
setup.py fix duplicate parameter key 2022-01-10 15:09:54 -05:00
test.ini stripe test mode 2024-12-13 00:58:29 +00:00

Make Post Sell
==============

The `Make Post Sell <https://www.makepostsell.com>`_ monolith platform service.


Getting Started
---------------

Clone this repo and change your working directory to the checkout.

Create a Python virtual environment and install project dependencies:

.. code-block:: bash

 make dev

Load schema and default data into the database using a script,
we currently use sqlite3 as a development and test database:

.. code-block:: bash

 make init_db config=development.ini

Run a web application server with the project loaded:

.. code-block:: bash

 make serve

In a web browser navagate to http://127.0.0.1:6501/ and you should see the app.


Running Tests
-------------

We currently use `pytest`:

.. code-block:: bash

 make test


SQL Migrations
===============

If your deployment is brand new, you don't need to run any migrations.
You should however run this to stamp the database as ready:

.. code-block:: bash

 alembic -c development.ini stamp head

Otherwise, it should be safe to run this at anytime to catch your database up:

.. code-block:: bash

 alembic -c development.ini upgrade head

To look at the current revision and the history run these:

.. code-block:: bash

 alembic -c development.ini history
 alembic -c development.ini current

If you ever want to cut a new migration script, you can run this:

.. code-block:: bash

 alembic -c development.ini revision -m "Added email_id column to User table."

Then you can edit / modify the generated ``.py`` file with your changes.

You can also autogenerate a new migration script using `--autogenerate`.
Alembic will prepare a migration script by comparing the state of the
database with the state of the model:

.. code-block:: bash

  alembic -c development.ini revision --autogenerate -m "autogenerated indicies."

You should review the recommended migration script before `upgrade`.

misc
====

You may source the new Python virtual environment during development:

.. code-block:: bash

 # source env/bin/activate.fish
 . env/bin/activate


Python Pyramid Shell
==========================

If you want to use an interactive Python interpreter to interact with Make Post Sell app/models & DB:

.. code-block:: bash

 pshell development.ini

For example, we needed to migrate production data using this script:

.. code-block:: python

 # begin the database transaction.
 request.tm.begin()

 suses = models.stripe_user_shop.get_all_stripe_user_shop_objects(request.dbsession)
 for sus in suses:
     try:
         sus.active_card_id = sus.stripe_customer_default_source.id
         request.dbsession.add(sus)
     except AttributeError:
         pass

 # flush / commit all changes stored the the sqlachemy session.
 request.dbsession.flush()

 # commit/close the database transaction to really make changes.
 request.tm.commit()


Contributing
===================

* Establish communication with Russell or another admin to bless your git.unturf.com gitlab account & put you into the proper roles.
* Russell should see your account request but due to spam you have to ask him directly for approval via email or some other means of comms.
* Clone repo & make commits
* Create merge requests, we automatically run the unit & headless functional tests on each commit
* On merge we release to the production site & see the change across users.

Optionally, format your code.

This is not set in stone, but if you want to use a formatter this is the path for now!

**Python**
  black (manual)

**Jinja2**
  None (not needed, neither is an HTML formatter)

**JavaScript**
  Prettier or biome (manual)

**CSS**
  Prettier or biome (manual)


Licence
=====================

All code contributed goes into the public domain.