1 | | - | |
2 | | - | # Develop |
3 | | - | |
4 | | - | For now Docker is a primary way of working on the repo. |
5 | | - | |
6 | | - | <br> |
7 | | - | |
8 | | - | ## Installation |
9 | | - | |
10 | | - | <br> |
11 | | - | |
12 | | - | 1. Create a virtual environment. |
13 | | - | |
14 | | - | ```sh |
15 | | - | # Install the package if it's not installed |
16 | | - | pip install virtualenv |
17 | | - | |
18 | | - | # Make it easier to manage python versions |
19 | | - | virtualenv --upgrade-embed-wheels |
20 | | - | virtualenv --python 3.8 venv |
21 | | - | ``` |
22 | | - | |
23 | | - | <br> |
24 | | - | |
25 | | - | 2. Activate the virtual environment. |
26 | | - | |
27 | | - | ```sh |
28 | | - | # Windows ➞ venv\Scripts\activate |
29 | | - | source venv/bin/activate |
30 | | - | ``` |
31 | | - | |
32 | | - | <br> |
33 | | - | |
34 | | - | 3. Install python packages. |
35 | | - | |
36 | | - | ```sh |
37 | | - | pip install \ |
38 | | - | --requirement requirements.txt |
39 | | - | ``` |
40 | | - | |
41 | | - | <br> |
42 | | - | |
43 | | - | 4. Install`pre-commit`hooks. |
44 | | - | |
45 | | - | ```sh |
46 | | - | pre-commit install --install-hooks |
47 | | - | ```` |
48 | | - | |
49 | | - | <br> |
50 | | - | <br> |
51 | | - | |
52 | | - | ## IDE |
53 | | - | |
54 | | - | *IDE specific instructions.* |
55 | | - | |
56 | | - | <br> |
57 | | - | |
58 | | - | ### VSCode |
59 | | - | |
60 | | - | <br> |
61 | | - | |
62 | | - | 1. Copy`.code-workspace`file. |
63 | | - | |
64 | | - | ```sh |
65 | | - | cp \ |
66 | | - | configs/workspace.code-workspace.example \ |
67 | | - | kemono-2.code-workspace |
68 | | - | ``` |
69 | | - | |
70 | | - | <br> |
71 | | - | |
72 | | - | 2. Install the recommended extensions. |
73 | | - | |
74 | | - | <br> |
75 | | - | <br> |
76 | | - | |
77 | | - | ## Docker |
78 | | - | |
79 | | - | <br> |
80 | | - | |
81 | | - | ```sh |
82 | | - | docker-compose --file docker-compose.dev.yml build |
83 | | - | docker-compose --file docker-compose.dev.yml up |
84 | | - | ``` |
85 | | - | |
86 | | - | <br> |
87 | | - | |
88 | | - | In a browser, visit[`http://localhost:5000/`] |
89 | | - | |
90 | | - | <br> |
91 | | - | |
92 | | - | ### Database |
93 | | - | |
94 | | - | <br> |
95 | | - | |
96 | | - | 1. Register an account. |
97 | | - | |
98 | | - | 2. Visit[`http://localhost:5000/development`] |
99 | | - | |
100 | | - | 3. Click either seeded or random generation. |
101 | | - | |
102 | | - | *This will start a mock import process,* <br> |
103 | | - | *which will also populate the database.* |
104 | | - | |
105 | | - | <br> |
106 | | - | |
107 | | - | ### Files |
108 | | - | |
109 | | - | TBD |
110 | | - | |
111 | | - | <br> |
112 | | - | |
113 | | - | ### Build |
114 | | - | |
115 | | - | ```sh |
116 | | - | docker-compose build |
117 | | - | docker-compose up --detach |
118 | | - | ``` |
119 | | - | |
120 | | - | <br> |
121 | | - | |
122 | | - | In a browser, visit[`http://localhost:8000/`] |
123 | | - | |
124 | | - | <br> |
125 | | - | <br> |
126 | | - | |
127 | | - | ## Manual |
128 | | - | |
129 | | - | > **TODO** : Write installation and setup instructions |
130 | | - | |
131 | | - | <br> |
132 | | - | |
133 | | - | This assumes you have`Python 3.8+`&`Node 12+`installed <br> |
134 | | - | as well as a running **PostgreSQL** server with **Pgroonga**. |
135 | | - | |
136 | | - | <br> |
137 | | - | |
138 | | - | ```sh |
139 | | - | # Make sure your database is initialized |
140 | | - | # cd to kemono directory |
141 | | - | |
142 | | - | pip install virtualenv |
143 | | - | virtualenv venv |
144 | | - | |
145 | | - | # Windows ➞ venv\Scripts\activate |
146 | | - | source venv/bin/activate |
147 | | - | |
148 | | - | pip install \ |
149 | | - | --requirement requirements.txt |
150 | | - | |
151 | | - | cd client \ |
152 | | - | && npm install \ |
153 | | - | && npm run build \ |
154 | | - | && cd .. |
155 | | - | |
156 | | - | # Open .env + Configure |
157 | | - | cp .env.example .env |
158 | | - | |
159 | | - | # Open flask.cfg + Configure |
160 | | - | cp flask.cfg.example flask.cfg |
161 | | - | |
162 | | - | set FLASK_APP=server.py |
163 | | - | set FLASK_ENV=development |
164 | | - | |
165 | | - | flask run |
166 | | - | ``` |
167 | | - | |
168 | | - | <br> |
169 | | - | |
170 | | - | |
171 | | - | <!-----------------------------------------------------------------------------> |
172 | | - | |
173 | | - | [`http://localhost:5000/development`]: http://localhost:5000/development |
174 | | - | [`http://localhost:5000/`]: http://localhost:5000/ |
175 | | - | [`http://localhost:8000/`]: http://localhost:8000/ |